mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-19 13:56:43 +02:00
Make owner commands cleaner
This commit is contained in:
@@ -1,29 +0,0 @@
|
|||||||
const Command = require('../../framework/Command');
|
|
||||||
const { DataResolver, Routes } = require('discord.js');
|
|
||||||
|
|
||||||
module.exports = class BannerCommand extends Command {
|
|
||||||
constructor(client) {
|
|
||||||
super(client, {
|
|
||||||
name: 'banner',
|
|
||||||
group: 'util',
|
|
||||||
memberName: 'banner',
|
|
||||||
description: 'Sets the bot\'s banner.',
|
|
||||||
details: 'Only the bot owner(s) may use this command.',
|
|
||||||
ownerOnly: true,
|
|
||||||
guarded: true,
|
|
||||||
args: [
|
|
||||||
{
|
|
||||||
key: 'image',
|
|
||||||
type: 'image'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async run(msg, { image }) {
|
|
||||||
await this.client.rest.patch(Routes.user(), {
|
|
||||||
body: { banner: await DataResolver.resolveImage(image) }
|
|
||||||
});
|
|
||||||
return msg.say('Set the banner.');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -30,7 +30,7 @@ module.exports = class CommandLastRunExportCommand extends Command {
|
|||||||
|
|
||||||
async run(msg) {
|
async run(msg) {
|
||||||
const result = this.client.exportLastRun();
|
const result = this.client.exportLastRun();
|
||||||
await msg.direct({ files: [{ attachment: result, name: 'command-last-run.json' }] });
|
if (msg.guild) await msg.say('📬 Sent `command-last-run.json` to your DMs!');
|
||||||
return msg.say('📬 Sent `command-last-run.json` to your DMs!');
|
return msg.direct({ files: [{ attachment: result, name: 'command-last-run.json' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ module.exports = class CommandLeaderboardExportCommand extends Command {
|
|||||||
|
|
||||||
async run(msg) {
|
async run(msg) {
|
||||||
const result = this.client.exportCommandLeaderboard();
|
const result = this.client.exportCommandLeaderboard();
|
||||||
await msg.direct({ files: [{ attachment: result, name: 'command-leaderboard.json' }] });
|
if (msg.guild) await msg.say('📬 Sent `command-leaderboard.json` to your DMs!');
|
||||||
return msg.say('📬 Sent `command-leaderboard.json` to your DMs!');
|
return msg.direct({ files: [{ attachment: result, name: 'command-leaderboard.json' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ module.exports = class GenerateCommandsCommand extends Command {
|
|||||||
})
|
})
|
||||||
.filter(cmds => cmds);
|
.filter(cmds => cmds);
|
||||||
const text = `Total: ${this.client.registry.commands.size}\n${list.join('\n')}`;
|
const text = `Total: ${this.client.registry.commands.size}\n${list.join('\n')}`;
|
||||||
await msg.direct({ files: [{ attachment: Buffer.from(text), name: 'commands.txt' }] });
|
if (msg.guild) await msg.say('📬 Sent `commands.txt` to your DMs!');
|
||||||
return msg.say('📬 Sent `commands.txt` to your DMs!');
|
return msg.direct({ files: [{ attachment: Buffer.from(text), name: 'commands.txt' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ module.exports = class GenerateCreditCommand extends Command {
|
|||||||
})
|
})
|
||||||
.filter(cmds => cmds);
|
.filter(cmds => cmds);
|
||||||
const file = Buffer.from(`## Credits\n### NPM Packages\n${npm}\n\n### Other Credits\n${list.join('\n')}`);
|
const file = Buffer.from(`## Credits\n### NPM Packages\n${npm}\n\n### Other Credits\n${list.join('\n')}`);
|
||||||
await msg.direct({ files: [{ attachment: file, name: 'credits.txt' }] });
|
if (msg.guild) await msg.say('📬 Sent `credits.txt` to your DMs!');
|
||||||
return msg.say('📬 Sent `credits.txt` to your DMs!');
|
return msg.direct({ files: [{ attachment: file, name: 'credits.txt' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ module.exports = class GenerateProcessEnvCommand extends Command {
|
|||||||
line = line.replace('=', '');
|
line = line.replace('=', '');
|
||||||
return `${line}="${process.env[line] || ''}"`;
|
return `${line}="${process.env[line] || ''}"`;
|
||||||
}).join('\n');
|
}).join('\n');
|
||||||
await msg.direct({ files: [{ attachment: Buffer.from(list), name: 'process.env.txt' }] });
|
if (msg.guild) await msg.say('📬 Sent `process.env.txt` to your DMs!');
|
||||||
return msg.say('📬 Sent `process.env.txt` to your DMs!');
|
return msg.direct({ files: [{ attachment: Buffer.from(list), name: 'process.env.txt' }] });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
+2
-2
@@ -25,7 +25,7 @@ module.exports = class IpCommand extends Command {
|
|||||||
const { body } = await request
|
const { body } = await request
|
||||||
.get('https://api.ipify.org/')
|
.get('https://api.ipify.org/')
|
||||||
.query({ format: 'json' });
|
.query({ format: 'json' });
|
||||||
await msg.direct(body.ip);
|
if (msg.guild) await msg.say('📬 Sent the IP to your DMs!');
|
||||||
return msg.say('📬 Sent the IP to your DMs!');
|
return msg.direct(body.ip);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user