mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
DBL is total garbage
This commit is contained in:
@@ -10,7 +10,6 @@ POSTER_ID=
|
|||||||
POSTER_TOKEN=
|
POSTER_TOKEN=
|
||||||
POSTER_TIME=
|
POSTER_TIME=
|
||||||
REPORT_CHANNEL_ID=
|
REPORT_CHANNEL_ID=
|
||||||
BOT_LIST_GUILDS=
|
|
||||||
|
|
||||||
# Emoji IDs
|
# Emoji IDs
|
||||||
GOLD_FISH_EMOJI_ID=
|
GOLD_FISH_EMOJI_ID=
|
||||||
@@ -52,7 +51,6 @@ SOUNDCLOUD_KEY=
|
|||||||
STACKOVERFLOW_KEY=
|
STACKOVERFLOW_KEY=
|
||||||
TENOR_KEY=
|
TENOR_KEY=
|
||||||
TMDB_KEY=
|
TMDB_KEY=
|
||||||
TOP_GG_TOKEN=
|
|
||||||
TUMBLR_KEY=
|
TUMBLR_KEY=
|
||||||
TWITTER_KEY=
|
TWITTER_KEY=
|
||||||
TWITTER_SECRET=
|
TWITTER_SECRET=
|
||||||
|
|||||||
@@ -74,7 +74,6 @@ client.on('message', async msg => {
|
|||||||
|
|
||||||
client.on('guildMemberRemove', async member => {
|
client.on('guildMemberRemove', async member => {
|
||||||
if (member.id === client.user.id) return null;
|
if (member.id === client.user.id) return null;
|
||||||
if (client.botListGuilds.includes(member.guild.id)) return null;
|
|
||||||
const channel = member.guild.systemChannel;
|
const channel = member.guild.systemChannel;
|
||||||
if (!channel || !channel.permissionsFor(client.user).has('SEND_MESSAGES')) return null;
|
if (!channel || !channel.permissionsFor(client.user).has('SEND_MESSAGES')) return null;
|
||||||
if (channel.topic && channel.topic.includes('<xiao:disable-leave>')) return null;
|
if (channel.topic && channel.topic.includes('<xiao:disable-leave>')) return null;
|
||||||
|
|||||||
@@ -35,10 +35,7 @@ module.exports = class CleverbotCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, { text }, fromPattern) {
|
async run(msg, { text }, fromPattern) {
|
||||||
if (fromPattern) {
|
if (fromPattern) text = msg.patternMatches[2];
|
||||||
if (msg.guild && this.client.botListGuilds.includes(msg.guild.id)) return null;
|
|
||||||
text = msg.patternMatches[2];
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
const convo = this.convos.get(msg.channel.id);
|
const convo = this.convos.get(msg.channel.id);
|
||||||
const { body } = await request
|
const { body } = await request
|
||||||
|
|||||||
@@ -10,22 +10,14 @@ module.exports = class GenerateCommandsCommand extends Command {
|
|||||||
description: 'Generates the commands list for Xiao\'s README.',
|
description: 'Generates the commands list for Xiao\'s README.',
|
||||||
details: 'Only the bot owner(s) may use this command.',
|
details: 'Only the bot owner(s) may use this command.',
|
||||||
ownerOnly: true,
|
ownerOnly: true,
|
||||||
guarded: true,
|
guarded: true
|
||||||
args: [
|
|
||||||
{
|
|
||||||
key: 'botList',
|
|
||||||
prompt: 'Do you want to generate the bot list version of the command list?',
|
|
||||||
type: 'boolean',
|
|
||||||
default: false
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
run(msg, { botList }) {
|
run(msg) {
|
||||||
const list = this.client.registry.groups
|
const list = this.client.registry.groups
|
||||||
.map(g => {
|
.map(g => {
|
||||||
const commands = g.commands.filter(c => !c.hidden && (botList ? !c.ownerOnly && !c.nsfw : true));
|
const commands = g.commands.filter(c => !c.hidden);
|
||||||
return `\n### ${g.name}:\n\n${commands.map(c => {
|
return `\n### ${g.name}:\n\n${commands.map(c => {
|
||||||
const extra = `${c.ownerOnly ? ' (Owner-Only)' : ''}${c.nsfw ? ' (NSFW)' : ''}`;
|
const extra = `${c.ownerOnly ? ' (Owner-Only)' : ''}${c.nsfw ? ' (NSFW)' : ''}`;
|
||||||
return `* **${c.name}:** ${c.description}${extra}`;
|
return `* **${c.name}:** ${c.description}${extra}`;
|
||||||
|
|||||||
@@ -34,10 +34,6 @@ module.exports = class HelpCommand extends Command {
|
|||||||
const commands = group.commands.filter(cmd => {
|
const commands = group.commands.filter(cmd => {
|
||||||
if (owner) return true;
|
if (owner) return true;
|
||||||
if (cmd.ownerOnly || cmd.hidden) return false;
|
if (cmd.ownerOnly || cmd.hidden) return false;
|
||||||
const inBotList = msg.guild && this.client.botListGuilds.includes(msg.guild.id);
|
|
||||||
if (inBotList && cmd instanceof AutoReplyCommand) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
if (!commands.size) continue;
|
if (!commands.size) continue;
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ module.exports = class UnknownCommandCommand extends Command {
|
|||||||
|
|
||||||
run(msg) {
|
run(msg) {
|
||||||
if (!msg.guild) return null;
|
if (!msg.guild) return null;
|
||||||
if (msg.guild && this.client.botListGuilds.includes(msg.guild.id)) return null;
|
|
||||||
const commands = this.makeCommandArray(this.client.isOwner(msg.author), msg.channel.nsfw);
|
const commands = this.makeCommandArray(this.client.isOwner(msg.author), msg.channel.nsfw);
|
||||||
const command = msg.content.match(this.client.dispatcher._commandPatterns[this.client.commandPrefix]);
|
const command = msg.content.match(this.client.dispatcher._commandPatterns[this.client.commandPrefix]);
|
||||||
const str = command ? command[2] : msg.content.split(' ')[0];
|
const str = command ? command[2] : msg.content.split(' ')[0];
|
||||||
|
|||||||
+1
-2
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "113.22.2",
|
"version": "113.22.3",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -38,7 +38,6 @@
|
|||||||
"cloc": "^2.5.1",
|
"cloc": "^2.5.1",
|
||||||
"common-tags": "^1.8.0",
|
"common-tags": "^1.8.0",
|
||||||
"custom-translate": "^2.2.8",
|
"custom-translate": "^2.2.8",
|
||||||
"dblapi.js": "^2.4.0",
|
|
||||||
"didyoumean2": "^4.0.0",
|
"didyoumean2": "^4.0.0",
|
||||||
"discord.js": "^12.2.0",
|
"discord.js": "^12.2.0",
|
||||||
"discord.js-commando": "github:discordjs/Commando",
|
"discord.js-commando": "github:discordjs/Commando",
|
||||||
|
|||||||
@@ -1,17 +1,15 @@
|
|||||||
const { CommandoClient } = require('discord.js-commando');
|
const { CommandoClient } = require('discord.js-commando');
|
||||||
const { WebhookClient } = require('discord.js');
|
const { WebhookClient } = require('discord.js');
|
||||||
const DBL = require('dblapi.js');
|
|
||||||
const Collection = require('@discordjs/collection');
|
const Collection = require('@discordjs/collection');
|
||||||
const winston = require('winston');
|
const winston = require('winston');
|
||||||
const PokemonStore = require('./pokemon/PokemonStore');
|
const PokemonStore = require('./pokemon/PokemonStore');
|
||||||
const MemePoster = require('./MemePoster');
|
const MemePoster = require('./MemePoster');
|
||||||
const { XIAO_WEBHOOK_ID, XIAO_WEBHOOK_TOKEN, BOT_LIST_GUILDS, TOP_GG_TOKEN } = process.env;
|
const { XIAO_WEBHOOK_ID, XIAO_WEBHOOK_TOKEN } = process.env;
|
||||||
|
|
||||||
module.exports = class XiaoClient extends CommandoClient {
|
module.exports = class XiaoClient extends CommandoClient {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
super(options);
|
super(options);
|
||||||
|
|
||||||
this.botListGuilds = BOT_LIST_GUILDS ? BOT_LIST_GUILDS.split(',') : [];
|
|
||||||
this.logger = winston.createLogger({
|
this.logger = winston.createLogger({
|
||||||
transports: [new winston.transports.Console()],
|
transports: [new winston.transports.Console()],
|
||||||
format: winston.format.combine(
|
format: winston.format.combine(
|
||||||
@@ -22,7 +20,6 @@ module.exports = class XiaoClient extends CommandoClient {
|
|||||||
this.webhook = new WebhookClient(XIAO_WEBHOOK_ID, XIAO_WEBHOOK_TOKEN, { disableEveryone: true });
|
this.webhook = new WebhookClient(XIAO_WEBHOOK_ID, XIAO_WEBHOOK_TOKEN, { disableEveryone: true });
|
||||||
this.pokemon = new PokemonStore();
|
this.pokemon = new PokemonStore();
|
||||||
this.memePoster = new MemePoster(this);
|
this.memePoster = new MemePoster(this);
|
||||||
this.dbl = TOP_GG_TOKEN ? new DBL(TOP_GG_TOKEN, this) : null;
|
|
||||||
this.games = new Collection();
|
this.games = new Collection();
|
||||||
this.phone = new Collection();
|
this.phone = new Collection();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ module.exports = class AutoReplyCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
run(msg, args, fromPattern) {
|
run(msg, args, fromPattern) {
|
||||||
if (msg.guild && this.client.botListGuilds.includes(msg.guild.id) && fromPattern) return null;
|
|
||||||
return this.reply ? msg.reply(this.generateText(fromPattern)) : msg.say(this.generateText(fromPattern));
|
return this.reply ? msg.reply(this.generateText(fromPattern)) : msg.say(this.generateText(fromPattern));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,10 +17,7 @@ module.exports = class SubredditCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, { subreddit }, fromPattern) {
|
async run(msg, { subreddit }, fromPattern) {
|
||||||
if (fromPattern) {
|
if (fromPattern) subreddit = msg.patternMatches[1];
|
||||||
if (msg.guild && this.client.botListGuilds.includes(msg.guild.id)) return null;
|
|
||||||
subreddit = msg.patternMatches[1];
|
|
||||||
}
|
|
||||||
if (!subreddit) subreddit = typeof this.subreddit === 'function' ? this.subreddit() : this.subreddit;
|
if (!subreddit) subreddit = typeof this.subreddit === 'function' ? this.subreddit() : this.subreddit;
|
||||||
try {
|
try {
|
||||||
const post = await this.random(subreddit, msg.channel.nsfw);
|
const post = await this.random(subreddit, msg.channel.nsfw);
|
||||||
|
|||||||
Reference in New Issue
Block a user