mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 22:32:50 +02:00
Remove smilebasic and rename-all
This commit is contained in:
@@ -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}\``);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -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
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "134.17.0",
|
"version": "135.0.0",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
|||||||
Reference in New Issue
Block a user