Remove smilebasic and rename-all

This commit is contained in:
Dragon Fire
2021-04-18 09:11:32 -04:00
parent 360313c9ea
commit b98a7032a8
3 changed files with 1 additions and 105 deletions
-64
View File
@@ -1,64 +0,0 @@
const Command = require('../../structures/Command');
const { verify } = require('../../util/Util');
module.exports = class RenameAllCommand extends Command {
constructor(client) {
super(client, {
name: 'rename-all',
group: 'other',
memberName: 'rename-all',
description: 'Renames every member of the server.',
details: 'Only the bot owner(s) may use this command.',
ownerOnly: true,
guildOnly: true,
clientPermissions: ['MANAGE_NICKNAMES', 'CHANGE_NICKNAME'],
userPermissions: ['ADMINISTRATOR'],
credit: [
{
name: 'Gawdl3y',
url: 'https://github.com/Gawdl3y',
reason: 'Concept'
}
],
args: [
{
key: 'nickname',
prompt: 'What nickname do you want everyone to have?',
type: 'string',
min: 2,
max: 32,
parse: nickname => {
if (nickname.toLowerCase() === 'none') return '';
return nickname;
}
}
]
});
}
async run(msg, { nickname }) {
try {
await msg.reply(
`Are you sure you want to ${nickname ? `rename everyone to **${nickname}**` : 'remove all nicknames'}?`
);
const verification = await verify(msg.channel, msg.author);
if (!verification) return msg.say('Aborted.');
await msg.reply('Fetching members...');
await msg.guild.members.fetch();
await msg.reply('Fetched members! Renaming...');
let i = 0;
for (const member of msg.guild.members.cache.values()) {
try {
await member.setNickname(nickname);
} catch {
i++;
continue;
}
}
if (!nickname) return msg.reply('Successfully removed all nicknames!');
return msg.reply(`Successfully renamed all but ${i} member${i === 1 ? '' : 's'} to **${nickname}**!`);
} catch (err) {
return msg.reply(`Failed to rename everyone: \`${err.message}\``);
}
}
};
-40
View File
@@ -1,40 +0,0 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
module.exports = class SmilebasicCommand extends Command {
constructor(client) {
super(client, {
name: 'smilebasic',
group: 'other',
memberName: 'smilebasic',
description: 'Responds with a ZIP file for a SmileBASIC project.',
clientPermissions: ['ATTACH_FILES'],
credit: [
{
name: 'SmileBASIC Source',
url: 'https://smilebasicsource.com/',
reason: 'API',
reasonURL: 'https://smilebasicsource.com/page?pid=1360'
}
],
args: [
{
key: 'key',
prompt: 'What project key would you like to get a ZIP for?',
type: 'string',
parse: key => key.toUpperCase()
}
]
});
}
async run(msg, { key }) {
try {
const { body } = await request.get(`http://sbapi.me/get/${key}/zip`);
return msg.say({ files: [{ attachment: body, name: `${key}.zip` }] });
} catch (err) {
if (err.status === 404) return msg.say('Could not find any results. Invalid key?');
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "134.17.0",
"version": "135.0.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"private": true,