mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-07 23:05:04 +02:00
Strip Trailing Space, Challenger
This commit is contained in:
+1
-2
@@ -80,7 +80,6 @@ client.on('message', async (msg) => {
|
||||
|
||||
client.on('messageReactionAdd', (reaction, user) => {
|
||||
if (reaction.emoji.name !== '⭐') return;
|
||||
if (reaction.count > 1) return;
|
||||
const msg = reaction.message;
|
||||
const channel = msg.guild.channels.get(msg.guild.settings.get('starboard'));
|
||||
if (!channel) return;
|
||||
@@ -94,7 +93,7 @@ client.on('messageReactionAdd', (reaction, user) => {
|
||||
|
||||
client.on('guildMemberAdd', (member) => {
|
||||
const role = member.guild.roles.get(member.guild.settings.get('joinRole'));
|
||||
if (member.guild.me.hasPermission('MANAGE_ROLES') && role)
|
||||
if (member.guild.me.hasPermission('MANAGE_ROLES') && role)
|
||||
member.addRole(role).catch(() => null);
|
||||
const channel = member.guild.channels.get(member.guild.settings.get('memberLog'));
|
||||
if (!channel) return;
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 105 KiB |
@@ -0,0 +1,58 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const Canvas = require('canvas');
|
||||
const snekfetch = require('snekfetch');
|
||||
const { promisifyAll } = require('tsubaki');
|
||||
const fs = promisifyAll(require('fs'));
|
||||
const path = require('path');
|
||||
|
||||
module.exports = class ChallengerCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'challenger',
|
||||
group: 'avataredit',
|
||||
memberName: 'challenger',
|
||||
description: 'A new foe has appeared.',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 15
|
||||
},
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
prompt: 'Which user would you like to edit the avatar of?',
|
||||
type: 'user'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||
return msg.say('This Command requires the `Attach Files` Permission.');
|
||||
const { user } = args;
|
||||
const avatarURL = user.avatarURL('png', 256);
|
||||
if (!avatarURL) return msg.say('This user has no avatar.');
|
||||
try {
|
||||
const Image = Canvas.Image;
|
||||
const canvas = new Canvas(500, 500);
|
||||
const ctx = canvas.getContext('2d');
|
||||
const base = new Image();
|
||||
const avatar = new Image();
|
||||
const generate = () => {
|
||||
ctx.fillStyle = '#ff0028';
|
||||
ctx.fillRect(0, 0, 500, 500);
|
||||
ctx.drawImage(avatar, 226, 155, 200, 200);
|
||||
ctx.drawImage(base, 0, 0);
|
||||
};
|
||||
base.src = await fs.readFileAsync(path.join(__dirname, '..', '..', 'assets', 'images', 'challenger.png'));
|
||||
const { body } = await snekfetch.get(avatarURL);
|
||||
avatar.src = body;
|
||||
generate();
|
||||
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'challenger.png' }] })
|
||||
.catch(err => msg.say(`${err.name}: ${err.message}`));
|
||||
} catch (err) {
|
||||
return msg.say(`${err.name}: ${err.message}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -29,7 +29,7 @@ module.exports = class BanCommand extends Command {
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
hasPermission(msg) {
|
||||
return msg.member.hasPermission('BAN_MEMBERS') || msg.member.roles.has(msg.guild.settings.get('staffRole'));
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ module.exports = class KickCommand extends Command {
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
hasPermission(msg) {
|
||||
return msg.member.hasPermission('KICK_MEMBERS') || msg.member.roles.has(msg.guild.settings.get('staffRole'));
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ module.exports = class LockdownCommand extends Command {
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
hasPermission(msg) {
|
||||
return msg.member.hasPermission('ADMINISTRATOR') || msg.member.roles.has(msg.guild.settings.get('staffRole'));
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ module.exports = class PruneCommand extends Command {
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
hasPermission(msg) {
|
||||
return msg.member.hasPermission('MANAGE_MESSAGES') || msg.member.roles.has(msg.guild.settings.get('staffRole'));
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ module.exports = class SoftbanCommand extends Command {
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
hasPermission(msg) {
|
||||
return msg.member.hasPermission('KICK_MEMBERS') || msg.member.roles.has(msg.guild.settings.get('staffRole'));
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ module.exports = class UnbanCommand extends Command {
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
hasPermission(msg) {
|
||||
return msg.member.hasPermission('BAN_MEMBERS') || msg.member.roles.has(msg.guild.settings.get('staffRole'));
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ module.exports = class WarnCommand extends Command {
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
hasPermission(msg) {
|
||||
return msg.member.hasPermission('KICK_MEMBERS') || msg.member.roles.has(msg.guild.settings.get('staffRole'));
|
||||
}
|
||||
|
||||
@@ -17,12 +17,15 @@ module.exports = class StarCommand extends Command {
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
this.starred = [];
|
||||
}
|
||||
|
||||
async run(msg, args, reaction) {
|
||||
const { id } = args;
|
||||
const channel = msg.guild.channels.get(msg.guild.settings.get('starboard'));
|
||||
if (!channel || !channel.permissionsFor(this.client.user).has('EMBED_LINKS')) return null;
|
||||
if (this.starred.includes(id)) return null;
|
||||
try {
|
||||
const message = await msg.channel.fetchMessage(id);
|
||||
if (!reaction && msg.author.id === message.author.id)
|
||||
@@ -33,6 +36,7 @@ module.exports = class StarCommand extends Command {
|
||||
.setDescription(message.content)
|
||||
.setImage(message.attachments.first() ? message.attachments.first().url : null)
|
||||
.setFooter(moment(message.createdTimestamp).format('MMMM Do YYYY h:mm:ss A'));
|
||||
this.starred.push(id);
|
||||
await channel.send({ embed });
|
||||
return null;
|
||||
} catch (err) {
|
||||
|
||||
@@ -22,7 +22,7 @@ module.exports = class ClearSettingCommand extends Command {
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
hasPermission(msg) {
|
||||
return msg.member.hasPermission('ADMINISTRATOR');
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ module.exports = class InviteGuardCommand extends Command {
|
||||
guildOnly: true
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
hasPermission(msg) {
|
||||
return msg.member.hasPermission('ADMINISTRATOR');
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ module.exports = class JoinRoleCommand extends Command {
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
hasPermission(msg) {
|
||||
return msg.member.hasPermission('ADMINISTRATOR');
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ module.exports = class MemberLogCommand extends Command {
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
hasPermission(msg) {
|
||||
return msg.member.hasPermission('ADMINISTRATOR');
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ module.exports = class ModChannelCommand extends Command {
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
hasPermission(msg) {
|
||||
return msg.member.hasPermission('ADMINISTRATOR');
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ module.exports = class SingleRoleCommand extends Command {
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
hasPermission(msg) {
|
||||
return msg.member.hasPermission('ADMINISTRATOR');
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ module.exports = class StaffRoleCommand extends Command {
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
hasPermission(msg) {
|
||||
return msg.member.hasPermission('ADMINISTRATOR');
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ module.exports = class StarboardCommand extends Command {
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
hasPermission(msg) {
|
||||
return msg.member.hasPermission('ADMINISTRATOR');
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ module.exports = class CowsayCommand extends Command {
|
||||
|
||||
run(msg, args) {
|
||||
const { text } = args;
|
||||
return msg.code(null,
|
||||
return msg.code(null,
|
||||
stripIndent`
|
||||
< ${text} >
|
||||
\\ ^__^
|
||||
|
||||
@@ -20,7 +20,7 @@ module.exports = class WebhookCommand extends Command {
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
hasPermission(msg) {
|
||||
return this.client.isOwner(msg.author);
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiaobot",
|
||||
"version": "21.2.4",
|
||||
"version": "21.2.5",
|
||||
"description": "A Discord Bot",
|
||||
"main": "Shard.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -5,7 +5,7 @@ class CommandoClient extends Client {
|
||||
constructor(options) {
|
||||
super(options);
|
||||
this.database = Database.db;
|
||||
|
||||
|
||||
Database.start();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user