mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-14 08:08:34 +02:00
Formatting
This commit is contained in:
@@ -8,40 +8,44 @@ const client = new commando.Client({
|
||||
});
|
||||
const Cleverbot = require('cleverbot-node');
|
||||
const cleverbot = new Cleverbot;
|
||||
cleverbot.configure({ botapi: config.clevkey });
|
||||
cleverbot.configure({
|
||||
botapi: config.clevkey
|
||||
});
|
||||
const clevusers = require('./clevusers.json');
|
||||
const path = require('path');
|
||||
|
||||
client.registry
|
||||
.registerDefaultTypes()
|
||||
.registerGroups([
|
||||
['botinfo', 'Bot Info'],
|
||||
['userinfo', 'User Info'],
|
||||
['guildinfo', 'Server Info'],
|
||||
['moderation', 'Moderation'],
|
||||
['response', 'Random Response'],
|
||||
['avataredit', 'Avatar Manipulation'],
|
||||
['textedit', 'Text Manipulation'],
|
||||
['numedit', 'Number Manipulation'],
|
||||
['imageedit', 'Image Manipulation'],
|
||||
['search', 'Search'],
|
||||
['random', 'Random/Other'],
|
||||
['roleplay', 'Roleplay']
|
||||
])
|
||||
.registerDefaultGroups()
|
||||
.registerDefaultCommands({ prefix: false })
|
||||
.registerCommandsIn(path.join(__dirname, 'commands'));
|
||||
.registerDefaultTypes()
|
||||
.registerGroups([
|
||||
['botinfo', 'Bot Info'],
|
||||
['userinfo', 'User Info'],
|
||||
['guildinfo', 'Server Info'],
|
||||
['moderation', 'Moderation'],
|
||||
['response', 'Random Response'],
|
||||
['avataredit', 'Avatar Manipulation'],
|
||||
['textedit', 'Text Manipulation'],
|
||||
['numedit', 'Number Manipulation'],
|
||||
['imageedit', 'Image Manipulation'],
|
||||
['search', 'Search'],
|
||||
['random', 'Random/Other'],
|
||||
['roleplay', 'Roleplay']
|
||||
])
|
||||
.registerDefaultGroups()
|
||||
.registerDefaultCommands({
|
||||
prefix: false
|
||||
})
|
||||
.registerCommandsIn(path.join(__dirname, 'commands'));
|
||||
|
||||
client.on('message', (message) => {
|
||||
if(message.author.bot) return;
|
||||
if(message.channel.type === 'dm') return;
|
||||
if(message.content.startsWith("<@" + client.user.id + ">")) {
|
||||
if(message.guild.id === config.server || message.guild.id === config.personalServer || message.author.id === config.owner) {
|
||||
if(message.author.id === clevusers.allowed[message.author.id]) {
|
||||
if (message.author.bot) return;
|
||||
if (message.channel.type === 'dm') return;
|
||||
if (message.content.startsWith("<@" + client.user.id + ">")) {
|
||||
if (message.guild.id === config.server || message.guild.id === config.personalServer || message.author.id === config.owner) {
|
||||
if (message.author.id === clevusers.allowed[message.author.id]) {
|
||||
let cleverMessage = message.content.replace("<@" + client.user.id + ">", "");
|
||||
console.log("[Cleverbot] " + cleverMessage);
|
||||
message.channel.startTyping();
|
||||
cleverbot.write(cleverMessage, function (response) {
|
||||
cleverbot.write(cleverMessage, function(response) {
|
||||
message.reply(response.output);
|
||||
message.channel.stopTyping();
|
||||
});
|
||||
@@ -51,14 +55,14 @@ client.on('message', (message) => {
|
||||
});
|
||||
|
||||
client.on('guildMemberAdd', member => {
|
||||
if(member.guild.id !== config.server) return;
|
||||
if (member.guild.id !== config.server) return;
|
||||
member.addRole(member.guild.roles.find('name', 'Members'));
|
||||
let addedMemberName = member.user.username;
|
||||
member.guild.channels.get(config.announcementChannel).send('Welcome ' + addedMemberName + '!');
|
||||
});
|
||||
|
||||
client.on('guildMemberRemove', member => {
|
||||
if(member.guild.id !== config.server) return;
|
||||
if (member.guild.id !== config.server) return;
|
||||
let removedMemberName = member.user.username;
|
||||
member.guild.channels.get(config.announcementChannel).send('Bye ' + removedMemberName + '...');
|
||||
});
|
||||
@@ -69,22 +73,29 @@ client.on('guildCreate', guild => {
|
||||
client.shard.fetchClientValues('guilds.size').then(results => {
|
||||
console.log("[Guild Count] " + results.reduce((prev, val) => prev + val, 0));
|
||||
request
|
||||
.post('https://www.carbonitex.net/discord/data/botdata.php')
|
||||
.send({ key: config.carbonkey, servercount: results.reduce((prev, val) => prev + val, 0) })
|
||||
.then(function (parsedBody) {
|
||||
console.log('[Carbon] Successfully posted to Carbon.');
|
||||
}).catch(function (err) {
|
||||
console.log("[Carbon] Failed to post to Carbon. " + err);
|
||||
});
|
||||
.post('https://www.carbonitex.net/discord/data/botdata.php')
|
||||
.send({
|
||||
key: config.carbonkey,
|
||||
servercount: results.reduce((prev, val) => prev + val, 0)
|
||||
})
|
||||
.then(function(parsedBody) {
|
||||
console.log('[Carbon] Successfully posted to Carbon.');
|
||||
}).catch(function(err) {
|
||||
console.log("[Carbon] Failed to post to Carbon. " + err);
|
||||
});
|
||||
request
|
||||
.post('https://bots.discord.pw/api/bots/' + config.botID + '/stats')
|
||||
.set({ 'Authorization': config.botskey })
|
||||
.send({ server_count: results.reduce((prev, val) => prev + val, 0) })
|
||||
.then(function (parsedBody) {
|
||||
console.log('[Discord Bots] Successfully posted to Discord Bots.');
|
||||
}).catch(function (err) {
|
||||
console.log("[Discord Bots] Failed to post to Discord Bots. " + err);
|
||||
});
|
||||
.post('https://bots.discord.pw/api/bots/' + config.botID + '/stats')
|
||||
.set({
|
||||
'Authorization': config.botskey
|
||||
})
|
||||
.send({
|
||||
server_count: results.reduce((prev, val) => prev + val, 0)
|
||||
})
|
||||
.then(function(parsedBody) {
|
||||
console.log('[Discord Bots] Successfully posted to Discord Bots.');
|
||||
}).catch(function(err) {
|
||||
console.log("[Discord Bots] Failed to post to Discord Bots. " + err);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -94,22 +105,29 @@ client.on('guildDelete', guild => {
|
||||
client.shard.fetchClientValues('guilds.size').then(results => {
|
||||
console.log("[Guild Count] " + results.reduce((prev, val) => prev + val, 0));
|
||||
request
|
||||
.post('https://www.carbonitex.net/discord/data/botdata.php')
|
||||
.send({ key: config.carbonkey, servercount: results.reduce((prev, val) => prev + val, 0) })
|
||||
.then(function (parsedBody) {
|
||||
console.log('[Carbon] Successfully posted to Carbon.');
|
||||
}).catch(function (err) {
|
||||
console.log("[Carbon] Failed to post to Carbon. " + err);
|
||||
});
|
||||
.post('https://www.carbonitex.net/discord/data/botdata.php')
|
||||
.send({
|
||||
key: config.carbonkey,
|
||||
servercount: results.reduce((prev, val) => prev + val, 0)
|
||||
})
|
||||
.then(function(parsedBody) {
|
||||
console.log('[Carbon] Successfully posted to Carbon.');
|
||||
}).catch(function(err) {
|
||||
console.log("[Carbon] Failed to post to Carbon. " + err);
|
||||
});
|
||||
request
|
||||
.post('https://bots.discord.pw/api/bots/' + config.botID + '/stats')
|
||||
.set({ 'Authorization': config.botskey })
|
||||
.send({ server_count: results.reduce((prev, val) => prev + val, 0) })
|
||||
.then(function (parsedBody) {
|
||||
console.log('[Discord Bots] Successfully posted to Discord Bots.');
|
||||
}).catch(function (err) {
|
||||
console.log("[Discord Bots] Failed to post to Discord Bots. " + err);
|
||||
});
|
||||
.post('https://bots.discord.pw/api/bots/' + config.botID + '/stats')
|
||||
.set({
|
||||
'Authorization': config.botskey
|
||||
})
|
||||
.send({
|
||||
server_count: results.reduce((prev, val) => prev + val, 0)
|
||||
})
|
||||
.then(function(parsedBody) {
|
||||
console.log('[Discord Bots] Successfully posted to Discord Bots.');
|
||||
}).catch(function(err) {
|
||||
console.log("[Discord Bots] Failed to post to Discord Bots. " + err);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -122,8 +140,8 @@ client.once('ready', () => {
|
||||
client.user.setGame(";help | dragonfire535");
|
||||
});
|
||||
|
||||
process.on('unhandledRejection', function (reason, p) {
|
||||
process.on('unhandledRejection', function(reason, p) {
|
||||
console.log("[Error] A Possibly Unhandled Rejection has Occurred. " + reason + p);
|
||||
});
|
||||
|
||||
client.login(config.token);
|
||||
client.login(config.token);
|
||||
|
||||
Reference in New Issue
Block a user