mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Switch to config.json, Eliz don't peek at my keys
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const { ShardingManager } = require('discord.js');
|
||||
const { TOKEN } = process.env;
|
||||
const Manager = new ShardingManager('./XiaoBot.js', { token: TOKEN });
|
||||
const { token } = require('./config');
|
||||
const Manager = new ShardingManager('./XiaoBot.js', { token });
|
||||
Manager.spawn();
|
||||
|
||||
+6
-6
@@ -1,10 +1,10 @@
|
||||
const { TOKEN, OWNER, PREFIX, INVITE } = process.env;
|
||||
const { token, owner, prefix, invite } = require('./config');
|
||||
const path = require('path');
|
||||
const { CommandoClient } = require('discord.js-commando');
|
||||
const client = new CommandoClient({
|
||||
commandPrefix: PREFIX,
|
||||
owner: OWNER,
|
||||
invite: INVITE,
|
||||
commandPrefix: prefix,
|
||||
owner,
|
||||
invite,
|
||||
disableEveryone: true,
|
||||
unknownCommandResponse: false,
|
||||
disabledEvents: [
|
||||
@@ -47,7 +47,7 @@ client.registry
|
||||
|
||||
client.on('ready', () => {
|
||||
console.log(`[READY] Shard ${client.shard.id} Logged in as ${client.user.tag} (${client.user.id})!`);
|
||||
client.user.setGame(`${PREFIX}help | Shard ${client.shard.id}`);
|
||||
client.user.setGame(`${prefix}help | Shard ${client.shard.id}`);
|
||||
});
|
||||
|
||||
client.on('disconnect', (event) => {
|
||||
@@ -128,6 +128,6 @@ client.on('guildDelete', async (guild) => {
|
||||
dBots(count, client.user.id);
|
||||
});
|
||||
|
||||
client.login(TOKEN);
|
||||
client.login(token);
|
||||
|
||||
process.on('unhandledRejection', console.error);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const snekfetch = require('snekfetch');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const { WORDNIK_KEY } = process.env;
|
||||
const { wordnikKey } = require('../../config');
|
||||
|
||||
module.exports = class HangmanCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -30,7 +30,7 @@ module.exports = class HangmanCommand extends Command {
|
||||
maxDictionaryCount: -1,
|
||||
minLength: -1,
|
||||
maxLength: -1,
|
||||
api_key: WORDNIK_KEY
|
||||
api_key: wordnikKey
|
||||
});
|
||||
const word = body.word.toLowerCase().replace(/[ ]/g, '-');
|
||||
let points = 0;
|
||||
|
||||
@@ -4,7 +4,7 @@ const snekfetch = require('snekfetch');
|
||||
const { cleanXML } = require('../../structures/Util');
|
||||
const { promisifyAll } = require('tsubaki');
|
||||
const xml = promisifyAll(require('xml2js'));
|
||||
const { ANIMELIST_LOGIN } = process.env;
|
||||
const { animelistLogin } = require('../../config');
|
||||
|
||||
module.exports = class AnimeCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -28,7 +28,7 @@ module.exports = class AnimeCommand extends Command {
|
||||
const { query } = args;
|
||||
try {
|
||||
const { text } = await snekfetch
|
||||
.get(`https://${ANIMELIST_LOGIN}@myanimelist.net/api/anime/search.xml`)
|
||||
.get(`https://${animelistLogin}@myanimelist.net/api/anime/search.xml`)
|
||||
.query({ q: query });
|
||||
const { anime } = await xml.parseStringAsync(text);
|
||||
const synopsis = cleanXML(anime.entry[0].synopsis[0].substr(0, 2000));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const snekfetch = require('snekfetch');
|
||||
const { DBOTS_KEY } = process.env;
|
||||
const { dbotsKey } = require('../../config');
|
||||
|
||||
module.exports = class BotSearchCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -26,7 +26,7 @@ module.exports = class BotSearchCommand extends Command {
|
||||
try {
|
||||
const { body } = await snekfetch
|
||||
.get(`https://bots.discord.pw/api/bots/${bot.id}`)
|
||||
.set({ Authorization: DBOTS_KEY });
|
||||
.set({ Authorization: dbotsKey });
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(0x9797FF)
|
||||
.setAuthor('Discord Bots', 'https://i.imgur.com/lrKYBQi.jpg')
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const snekfetch = require('snekfetch');
|
||||
const { WORDNIK_KEY } = process.env;
|
||||
const { wordnikKey } = require('../../config');
|
||||
|
||||
module.exports = class DefineCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -30,7 +30,7 @@ module.exports = class DefineCommand extends Command {
|
||||
limit: 1,
|
||||
includeRelated: false,
|
||||
useCanonical: false,
|
||||
api_key: WORDNIK_KEY
|
||||
api_key: wordnikKey
|
||||
});
|
||||
if (!body.length) return msg.say('No Results.');
|
||||
const embed = new MessageEmbed()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const snekfetch = require('snekfetch');
|
||||
const { GIPHY_KEY } = process.env;
|
||||
const { giphyKey } = require('../../config');
|
||||
|
||||
module.exports = class GiphyCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -25,7 +25,7 @@ module.exports = class GiphyCommand extends Command {
|
||||
.get('http://api.giphy.com/v1/gifs/search')
|
||||
.query({
|
||||
q: query,
|
||||
api_key: GIPHY_KEY,
|
||||
api_key: giphyKey,
|
||||
rating: msg.channel.nsfw ? 'r' : 'pg'
|
||||
});
|
||||
if (!body.data.length) return msg.say('No Results.');
|
||||
|
||||
@@ -2,7 +2,7 @@ const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const snekfetch = require('snekfetch');
|
||||
const moment = require('moment');
|
||||
const { GITHUB_LOGIN } = process.env;
|
||||
const { githubLogin } = require('../../config');
|
||||
|
||||
module.exports = class GithubCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -26,7 +26,7 @@ module.exports = class GithubCommand extends Command {
|
||||
const { repo } = args;
|
||||
try {
|
||||
const { body } = await snekfetch
|
||||
.get(`https://${GITHUB_LOGIN}@api.github.com/repos/${repo}`);
|
||||
.get(`https://${githubLogin}@api.github.com/repos/${repo}`);
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(0xFFFFFF)
|
||||
.setAuthor('Github', 'https://i.imgur.com/ajcPgJG.png')
|
||||
|
||||
@@ -4,7 +4,7 @@ const snekfetch = require('snekfetch');
|
||||
const { cleanXML } = require('../../structures/Util');
|
||||
const { promisifyAll } = require('tsubaki');
|
||||
const xml = promisifyAll(require('xml2js'));
|
||||
const { ANIMELIST_LOGIN } = process.env;
|
||||
const { animelistLogin } = require('../../config');
|
||||
|
||||
module.exports = class MangaCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -28,7 +28,7 @@ module.exports = class MangaCommand extends Command {
|
||||
const { query } = args;
|
||||
try {
|
||||
const { text } = await snekfetch
|
||||
.get(`https://${ANIMELIST_LOGIN}@myanimelist.net/api/manga/search.xml`)
|
||||
.get(`https://${animelistLogin}@myanimelist.net/api/manga/search.xml`)
|
||||
.query({ q: query });
|
||||
const { manga } = await xml.parseStringAsync(text);
|
||||
const synopsis = cleanXML(manga.entry[0].synopsis[0].substr(0, 2000));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const snekfetch = require('snekfetch');
|
||||
const { GOOGLE_KEY } = process.env;
|
||||
const { googleKey } = require('../../config');
|
||||
|
||||
module.exports = class MapCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -38,7 +38,7 @@ module.exports = class MapCommand extends Command {
|
||||
center: query,
|
||||
zoom,
|
||||
size: '500x500',
|
||||
key: GOOGLE_KEY
|
||||
key: googleKey
|
||||
});
|
||||
return msg.say({ files: [{ attachment: body, name: 'map.png' }] });
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const snekfetch = require('snekfetch');
|
||||
const { OSU_KEY } = process.env;
|
||||
const { osuKey } = require('../../config');
|
||||
|
||||
module.exports = class OsuCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -26,7 +26,7 @@ module.exports = class OsuCommand extends Command {
|
||||
const { body } = await snekfetch
|
||||
.get('https://osu.ppy.sh/api/get_user')
|
||||
.query({
|
||||
k: OSU_KEY,
|
||||
k: osuKey,
|
||||
u: query,
|
||||
type: 'string'
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const snekfetch = require('snekfetch');
|
||||
const { SOUNDCLOUD_KEY } = process.env;
|
||||
const { soundcloudKey } = require('../../config');
|
||||
|
||||
module.exports = class SoundCloudCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -27,7 +27,7 @@ module.exports = class SoundCloudCommand extends Command {
|
||||
.get('https://api.soundcloud.com/tracks')
|
||||
.query({
|
||||
q: query,
|
||||
client_id: SOUNDCLOUD_KEY
|
||||
client_id: soundcloudKey
|
||||
});
|
||||
if (!body.length) return msg.say('No Results.');
|
||||
const embed = new MessageEmbed()
|
||||
|
||||
@@ -2,7 +2,7 @@ const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const snekfetch = require('snekfetch');
|
||||
const moment = require('moment');
|
||||
const { WATTPAD_KEY } = process.env;
|
||||
const { wattpadKey } = require('../../config');
|
||||
|
||||
module.exports = class WattpadCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -30,7 +30,7 @@ module.exports = class WattpadCommand extends Command {
|
||||
query,
|
||||
limit: 1
|
||||
})
|
||||
.set({ Authorization: `Basic ${WATTPAD_KEY}` });
|
||||
.set({ Authorization: `Basic ${wattpadKey}` });
|
||||
if (!body.stories.length) return msg.say('No Results.');
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(0xF89C34)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const snekfetch = require('snekfetch');
|
||||
const { GOOGLE_KEY } = process.env;
|
||||
const { googleKey } = require('../../config');
|
||||
|
||||
module.exports = class YouTubeCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -30,7 +30,7 @@ module.exports = class YouTubeCommand extends Command {
|
||||
type: 'video',
|
||||
maxResults: 1,
|
||||
q: query,
|
||||
key: GOOGLE_KEY
|
||||
key: googleKey
|
||||
});
|
||||
if (!body.items.length) return msg.say('No Results.');
|
||||
const embed = new MessageEmbed()
|
||||
|
||||
@@ -2,7 +2,7 @@ const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const snekfetch = require('snekfetch');
|
||||
const codes = require('../../assets/json/translate');
|
||||
const { YANDEX_KEY } = process.env;
|
||||
const { yandexKey } = require('../../config');
|
||||
|
||||
module.exports = class TranslateCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -53,7 +53,7 @@ module.exports = class TranslateCommand extends Command {
|
||||
const { body } = await snekfetch
|
||||
.get('https://translate.yandex.net/api/v1.5/tr.json/translate')
|
||||
.query({
|
||||
key: YANDEX_KEY,
|
||||
key: yandexKey,
|
||||
text,
|
||||
lang: from ? `${from}-${to}` : to
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const snekfetch = require('snekfetch');
|
||||
const { WEBHOOK_URL } = process.env;
|
||||
const { webhookURL } = require('../../config');
|
||||
|
||||
module.exports = class WebhookCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -9,7 +9,7 @@ module.exports = class WebhookCommand extends Command {
|
||||
aliases: ['rin', 'rin-say'],
|
||||
group: 'text-edit',
|
||||
memberName: 'webhook',
|
||||
description: 'Posts a message to the webhook defined in your `process.env`.',
|
||||
description: 'Posts a message to the webhook defined in your `config.json`.',
|
||||
guildOnly: true,
|
||||
ownerOnly: true,
|
||||
clientPermissions: ['MANAGE_MESSAGES'],
|
||||
@@ -27,7 +27,7 @@ module.exports = class WebhookCommand extends Command {
|
||||
const { content } = args;
|
||||
msg.delete();
|
||||
await snekfetch
|
||||
.post(WEBHOOK_URL)
|
||||
.post(webhookURL)
|
||||
.send({ content });
|
||||
return null;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiaobot",
|
||||
"version": "26.2.1",
|
||||
"version": "26.2.2",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Shard.js",
|
||||
"scripts": {
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
const snekfetch = require('snekfetch');
|
||||
const { CARBON_KEY, DBOTS_KEY } = process.env;
|
||||
const { carbonKey, dbotsKey } = require('../config');
|
||||
|
||||
class Util {
|
||||
static cleanXML(str) {
|
||||
@@ -14,7 +14,7 @@ class Util {
|
||||
static dBots(count, id) {
|
||||
snekfetch
|
||||
.post(`https://bots.discord.pw/api/bots/${id}/stats`)
|
||||
.set({ Authorization: DBOTS_KEY })
|
||||
.set({ Authorization: dbotsKey })
|
||||
.send({ server_count: count })
|
||||
.then(() => console.log('[CARBON] Successfully posted to Carbon.'))
|
||||
.catch((err) => console.error(`[CARBON] Failed to post to Carbon. ${err}`));
|
||||
@@ -24,7 +24,7 @@ class Util {
|
||||
snekfetch
|
||||
.post('https://www.carbonitex.net/discord/data/botdata.php')
|
||||
.send({
|
||||
key: CARBON_KEY,
|
||||
key: carbonKey,
|
||||
servercount: count
|
||||
})
|
||||
.then(() => console.log('[DBOTS] Successfully posted to Discord Bots.'))
|
||||
|
||||
Reference in New Issue
Block a user