mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Move to snekfetch 🐍
This commit is contained in:
@@ -13,7 +13,7 @@ You can add XiaoBot to your server with [this link](https://discordapp.com/oauth
|
||||
You can join the home server with [this link](https://discord.gg/fqQF8mc).
|
||||
|
||||
## Modules
|
||||
[discord.js](https://discord.js.org/#/), [commando](https://github.com/Gawdl3y/discord.js-commando), [zalgoize](https://github.com/clux/zalgolize), [superagent](https://github.com/visionmedia/superagent), [mathjs](http://mathjs.org/), [moment](http://momentjs.com), [moment-duration-format](https://github.com/jsmreese/moment-duration-format), [jimp](https://github.com/oliver-moran/jimp), [cheerio](https://cheerio.js.org/)
|
||||
[discord.js](https://discord.js.org/#/), [commando](https://github.com/Gawdl3y/discord.js-commando), [zalgoize](https://github.com/clux/zalgolize), [snekfetch](https://github.com/GusCaplan/snekfetch), [mathjs](http://mathjs.org/), [moment](http://momentjs.com), [moment-duration-format](https://github.com/jsmreese/moment-duration-format), [jimp](https://github.com/oliver-moran/jimp), [cheerio](https://cheerio.js.org/)
|
||||
|
||||
## APIs
|
||||
[Wattpad](https://developer.wattpad.com/docs/api), [Wordnik](http://developer.wordnik.com/docs.html), [osu!](https://osu.ppy.sh/p/api), [memegen.link](https://memegen.link/), [Yugioh Prices](http://docs.yugiohprices.apiary.io/#), [YouTube Data](https://developers.google.com/youtube/v3/), [Yoda Speak](https://market.mashape.com/ismaelc/yoda-speak), [Discord Bots](https://bots.discord.pw/api), [Today in History](http://history.muffinlabs.com/#api), [jService](http://jservice.io/), [Strawpoll](https://github.com/strawpoll/strawpoll/wiki/API), [Urban Dictionary](https://github.com/zdict/zdict/wiki/Urban-dictionary-API-documentation), [OMDB](http://www.omdbapi.com/), [Yahoo Weather](https://developer.yahoo.com/weather/), [Yandex.Translate](https://translate.yandex.com/developers), [Wikipedia](https://en.wikipedia.org/w/api.php), [Google Static Maps](https://developers.google.com/maps/documentation/static-maps/)
|
||||
|
||||
@@ -26,7 +26,7 @@ module.exports = class SteamCardCommand extends Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('ATTACH_FILES')) return message.say(':x: Error! I don\'t have the Attach Files Permission!');
|
||||
}
|
||||
const user = args.user;
|
||||
const userDisplayName = message.guild ? message.guild.member(user).displayName : user.username;
|
||||
const userDisplayName = user.username;
|
||||
let userAvatar = user.displayAvatarURL;
|
||||
userAvatar = userAvatar.replace('.jpg', '.png');
|
||||
userAvatar = userAvatar.replace('.gif', '.png');
|
||||
|
||||
@@ -16,7 +16,7 @@ module.exports = class LotteryCommand extends Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
}
|
||||
const lottery = ['Winner'][Math.floor(Math.random() * 100)];
|
||||
const userName = message.member ? message.member.displayName : message.author.username;
|
||||
const userName = message.author.username;
|
||||
if (lottery !== 'Winner') return message.say(`Nope, sorry ${userName}, you lost.`);
|
||||
return message.say(`Wow ${userName}! You actually won! Great job!`);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { RichEmbed } = require('discord.js');
|
||||
const request = require('superagent');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class QuizCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -22,11 +22,8 @@ module.exports = class QuizCommand extends Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
}
|
||||
try {
|
||||
const response = await request
|
||||
.get('http://jservice.io/api/random')
|
||||
.query({
|
||||
count: 1
|
||||
});
|
||||
const response = await snekfetch
|
||||
.get('http://jservice.io/api/random?count=1');
|
||||
const data = response.body[0];
|
||||
const answer = data.answer.toLowerCase().replace(/(<i>|<\/i>)/g, '');
|
||||
const embed = new RichEmbed()
|
||||
|
||||
@@ -16,7 +16,7 @@ module.exports = class BanCommand extends Command {
|
||||
args: [{
|
||||
key: 'member',
|
||||
prompt: 'What member do you want to ban?',
|
||||
type: 'member'
|
||||
type: 'user'
|
||||
}, {
|
||||
key: 'reason',
|
||||
prompt: 'What do you want to set the reason as?',
|
||||
@@ -41,7 +41,10 @@ module.exports = class BanCommand extends Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('BAN_MEMBERS')) return message.say(':x: Error! I don\'t have the Ban Members Permission!');
|
||||
}
|
||||
if (!message.guild.channels.exists('name', 'mod_logs')) return message.say(':x: Error! Could not find the mod_logs channel! Please create it!');
|
||||
const member = args.member;
|
||||
let member = message.guild.member(args.member);
|
||||
if (!member) {
|
||||
member = await message.guild.fetchMember(args.member);
|
||||
}
|
||||
const reason = args.reason;
|
||||
if (!member.bannable) return message.say(':x: Error! This member cannot be banned! Perhaps they have a higher role than me?');
|
||||
try {
|
||||
|
||||
@@ -13,7 +13,7 @@ module.exports = class KickCommand extends Command {
|
||||
args: [{
|
||||
key: 'member',
|
||||
prompt: 'What member do you want to kick?',
|
||||
type: 'member'
|
||||
type: 'user'
|
||||
}, {
|
||||
key: 'reason',
|
||||
prompt: 'What do you want to set the reason as?',
|
||||
@@ -38,7 +38,10 @@ module.exports = class KickCommand extends Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('KICK_MEMBERS')) return message.say(':x: Error! I don\'t have the Kick Members Permission!');
|
||||
}
|
||||
if (!message.guild.channels.exists('name', 'mod_logs')) return message.say(':x: Error! Could not find the mod_logs channel! Please create it!');
|
||||
const member = args.member;
|
||||
let member = message.guild.member(args.member);
|
||||
if (!member) {
|
||||
member = await message.guild.fetchMember(args.member);
|
||||
}
|
||||
const reason = args.reason;
|
||||
if (!member.bannable) return message.say(':x: Error! This member cannot be kicked! Perhaps they have a higher role than me?');
|
||||
try {
|
||||
|
||||
@@ -13,7 +13,7 @@ module.exports = class WarnCommand extends Command {
|
||||
args: [{
|
||||
key: 'member',
|
||||
prompt: 'What member do you want to warn?',
|
||||
type: 'member'
|
||||
type: 'user'
|
||||
}, {
|
||||
key: 'reason',
|
||||
prompt: 'What do you want to set the reason as?',
|
||||
@@ -36,7 +36,10 @@ module.exports = class WarnCommand extends Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
}
|
||||
const member = args.member;
|
||||
let member = message.guild.member(args.member);
|
||||
if (!member) {
|
||||
member = await message.guild.fetchMember(args.member);
|
||||
}
|
||||
const reason = args.reason;
|
||||
if (!message.guild.channels.exists('name', 'mod_logs')) return message.say(':x: Error! Could not find the mod_logs channel! Please create it!');
|
||||
try {
|
||||
|
||||
@@ -11,7 +11,7 @@ module.exports = class MathCommand extends Command {
|
||||
'multiply',
|
||||
'divide'
|
||||
],
|
||||
group: 'numedit',
|
||||
group: 'random',
|
||||
memberName: 'math',
|
||||
description: 'Does Math (;math 2 + 2)',
|
||||
examples: [';math 2 + 2'],
|
||||
@@ -1,5 +1,5 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const request = require('superagent');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class StrawpollCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -41,7 +41,7 @@ module.exports = class StrawpollCommand extends Command {
|
||||
if (choices.length < 2) return message.say(':x: Error! You provided less than two choices!');
|
||||
if (choices.length > 31) return message.say(':x: Error! You provided more than thirty choices!');
|
||||
try {
|
||||
const response = await request
|
||||
const response = await snekfetch
|
||||
.post('https://strawpoll.me/api/v2/polls')
|
||||
.send({
|
||||
title: title,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { RichEmbed } = require('discord.js');
|
||||
const request = require('superagent');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class TodayCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -22,12 +22,9 @@ module.exports = class TodayCommand extends Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
}
|
||||
try {
|
||||
const response = await request
|
||||
const response = await snekfetch
|
||||
.get('http://history.muffinlabs.com/date')
|
||||
.set({
|
||||
'Accept': 'application/json'
|
||||
})
|
||||
.buffer(true);
|
||||
.buffer();
|
||||
const parsedResponse = JSON.parse(response.text);
|
||||
const events = parsedResponse.data.Events;
|
||||
const randomNumber = Math.floor(Math.random() * events.length);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { RichEmbed } = require('discord.js');
|
||||
const request = require('superagent');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class BotSearchCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -29,7 +29,7 @@ module.exports = class BotSearchCommand extends Command {
|
||||
}
|
||||
const bot = args.bot.id;
|
||||
try {
|
||||
const response = await request
|
||||
const response = await snekfetch
|
||||
.get(`https://bots.discord.pw/api/bots/${bot}`)
|
||||
.set({
|
||||
'Authorization': process.env.DISCORD_BOTS_KEY
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { RichEmbed } = require('discord.js');
|
||||
const request = require('superagent');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class DefineCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -29,17 +29,10 @@ module.exports = class DefineCommand extends Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
}
|
||||
const word = encodeURI(args.word);
|
||||
const word = encodeURIComponent(args.word);
|
||||
try {
|
||||
const response = await request
|
||||
.get(`http://api.wordnik.com:80/v4/word.json/${word}/definitions`)
|
||||
.query({
|
||||
limit: 1,
|
||||
includeRelated: false,
|
||||
useCanonical: false,
|
||||
includeTags: false,
|
||||
api_key: process.env.WORDNIK_KEY
|
||||
});
|
||||
const response = await snekfetch
|
||||
.get(`http://api.wordnik.com:80/v4/word.json/${word}/definitions?limit=1&includeRelated=false&useCanonical=false&api_key=${process.env.WORDNIK_KEY}`);
|
||||
const data = response.body[0];
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0x9797FF)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { RichEmbed } = require('discord.js');
|
||||
const request = require('superagent');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class ForecastCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -26,14 +26,10 @@ module.exports = class ForecastCommand extends Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
}
|
||||
const location = args.locationQ;
|
||||
const location = encodeURIComponent(args.locationQ);
|
||||
try {
|
||||
const response = await request
|
||||
.get('https://query.yahooapis.com/v1/public/yql')
|
||||
.query({
|
||||
q: `select * from weather.forecast where u='f' AND woeid in (select woeid from geo.places(1) where text="${location}")`,
|
||||
format: 'json'
|
||||
});
|
||||
const response = await snekfetch
|
||||
.get(`https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where u=\'f\' AND woeid in (select woeid from geo.places(1) where text="${location}")&format=json`);
|
||||
const info = response.body.query.results.channel;
|
||||
const data = info.item.forecast;
|
||||
const embed = new RichEmbed()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const request = require('superagent');
|
||||
const snekfetch = require('snekfetch');
|
||||
const cheerio = require('cheerio');
|
||||
const querystring = require('querystring');
|
||||
|
||||
@@ -26,14 +26,11 @@ module.exports = class GoogleCommand extends Command {
|
||||
if (message.channel.type !== 'dm') {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
}
|
||||
const query = args.query;
|
||||
const query = encodeURIComponent(args.query);
|
||||
const msg = await message.say('Searching...');
|
||||
try {
|
||||
const response = await request
|
||||
.get(`https://www.google.com/search`)
|
||||
.query({
|
||||
q: query
|
||||
});
|
||||
const response = await snekfetch
|
||||
.get(`https://www.google.com/search?q=${query}`);
|
||||
const $ = cheerio.load(response.text);
|
||||
let href = $('.r').first().find('a').first().attr('href');
|
||||
href = querystring.parse(href.replace('/url?', ''));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { RichEmbed } = require('discord.js');
|
||||
const request = require('superagent');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class IMDBCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -28,14 +28,10 @@ module.exports = class IMDBCommand extends Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
}
|
||||
const movie = args.movie;
|
||||
const movie = encodeURIComponent(args.movie);
|
||||
try {
|
||||
const response = await request
|
||||
.get(`http://www.omdbapi.com/`)
|
||||
.query({
|
||||
t: movie,
|
||||
plot: 'full'
|
||||
});
|
||||
const response = await snekfetch
|
||||
.get(`http://www.omdbapi.com/?t=${movie}&plot=full`);
|
||||
const data = response.body;
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0xDBA628)
|
||||
|
||||
+4
-10
@@ -1,5 +1,5 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const request = require('superagent');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class MapCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -36,16 +36,10 @@ module.exports = class MapCommand extends Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('ATTACH_FILES')) return message.say(':x: Error! I don\'t have the Attach Files Permission!');
|
||||
}
|
||||
const zoom = args.zoom;
|
||||
const locationQ = args.locationQ;
|
||||
const location = encodeURIComponent(args.locationQ);
|
||||
try {
|
||||
const response = await request
|
||||
.get('https://maps.googleapis.com/maps/api/staticmap')
|
||||
.query({
|
||||
center: locationQ,
|
||||
zoom: zoom,
|
||||
size: '500x500',
|
||||
key: process.env.GOOGLE_KEY
|
||||
});
|
||||
const response = await snekfetch
|
||||
.get(`https://maps.googleapis.com/maps/api/staticmap?center=${location}&zoom=${zoom}&size=500x500&key=${process.env.GOOGLE_KEY}`);
|
||||
return message.channel.sendFile(response.body);
|
||||
}
|
||||
catch (err) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const request = require('superagent');
|
||||
const snekfetch = require('snekfetch');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = class NeopetCommand extends Command {
|
||||
@@ -23,15 +23,10 @@ module.exports = class NeopetCommand extends Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('ATTACH_FILES')) return message.say(':x: Error! I don\'t have the Attach Files Permission!');
|
||||
}
|
||||
const pet = args.pet;
|
||||
const pet = encodeURIComponent(args.pet);
|
||||
try {
|
||||
const response = await request
|
||||
.get('http://www.sunnyneo.com/petimagefinder.php')
|
||||
.query({
|
||||
name: pet,
|
||||
size: 5,
|
||||
mood: 1
|
||||
});
|
||||
const response = await snekfetch
|
||||
.get(`http://www.sunnyneo.com/petimagefinder.php?name=${pet}&size=5&mood=1`);
|
||||
const $ = cheerio.load(response.text);
|
||||
const link = $('textarea').first().text();
|
||||
if (!link.includes('cp')) return message.say(':x: Error! Pet not found!');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { RichEmbed } = require('discord.js');
|
||||
const request = require('superagent');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class OsuCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -28,15 +28,10 @@ module.exports = class OsuCommand extends Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
}
|
||||
const username = args.username;
|
||||
const username = encodeURIComponent(args.username);
|
||||
try {
|
||||
const response = await request
|
||||
.get('https://osu.ppy.sh/api/get_user')
|
||||
.query({
|
||||
k: process.env.OSU_KEY,
|
||||
u: username,
|
||||
type: 'string'
|
||||
});
|
||||
const response = await snekfetch
|
||||
.get(`https://osu.ppy.sh/api/get_user?k=${process.env.OSU_KEY}&u=${username}&type=string`);
|
||||
const data = response.body[0];
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0xFF66AA)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { RichEmbed } = require('discord.js');
|
||||
const request = require('superagent');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class UrbanCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -28,13 +28,10 @@ module.exports = class UrbanCommand extends Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
}
|
||||
const word = args.word;
|
||||
const word = encodeURIComponent(args.word);
|
||||
try {
|
||||
const response = await request
|
||||
.get('http://api.urbandictionary.com/v0/define')
|
||||
.query({
|
||||
term: word
|
||||
});
|
||||
const response = await snekfetch
|
||||
.get(`http://api.urbandictionary.com/v0/define?term=${word}`);
|
||||
const data = response.body.list[0];
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0x32a8f0)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { RichEmbed } = require('discord.js');
|
||||
const request = require('superagent');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class WattpadCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -23,16 +23,12 @@ module.exports = class WattpadCommand extends Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
}
|
||||
const book = args.book;
|
||||
const book = encodeURIComponent(args.book);
|
||||
try {
|
||||
const response = await request
|
||||
.get('https://api.wattpad.com:443/v4/stories')
|
||||
const response = await snekfetch
|
||||
.get(`https://api.wattpad.com:443/v4/stories?query=${book}&limit=1`)
|
||||
.set({
|
||||
'Authorization': `Basic ${process.env.WATTPAD_KEY}`
|
||||
})
|
||||
.query({
|
||||
query: book,
|
||||
limit: 1
|
||||
});
|
||||
const data = response.body.stories[0];
|
||||
const embed = new RichEmbed()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { RichEmbed } = require('discord.js');
|
||||
const request = require('superagent');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class WeatherCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -23,14 +23,10 @@ module.exports = class WeatherCommand extends Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
}
|
||||
const location = args.locationQ;
|
||||
const location = encodeURIComponent(args.locationQ);
|
||||
try {
|
||||
const response = await request
|
||||
.get('https://query.yahooapis.com/v1/public/yql')
|
||||
.query({
|
||||
q: `select * from weather.forecast where u='f' AND woeid in (select woeid from geo.places(1) where text="${location}")`,
|
||||
format: 'json'
|
||||
});
|
||||
const response = await snekfetch
|
||||
.get(`https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where u=\'f\' AND woeid in (select woeid from geo.places(1) where text="${location}")&format=json`);
|
||||
const data = response.body.query.results.channel;
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0x0000FF)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { RichEmbed } = require('discord.js');
|
||||
const request = require('superagent');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class WikipediaCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -23,27 +23,16 @@ module.exports = class WikipediaCommand extends Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
}
|
||||
const query = args.query.replace(/[)]/g, '%29');
|
||||
const title = encodeURI(query);
|
||||
const query = encodeURIComponent(args.query.replace(/[)]/g, '%29'));
|
||||
try {
|
||||
const response = await request
|
||||
.get(`https://en.wikipedia.org/w/api.php`)
|
||||
.query({
|
||||
action: 'query',
|
||||
prop: 'extracts',
|
||||
format: 'json',
|
||||
titles: query,
|
||||
exintro: '',
|
||||
explaintext: '',
|
||||
redirects: '',
|
||||
formatversion: 2
|
||||
});
|
||||
const response = await snekfetch
|
||||
.get(`https://en.wikipedia.org/w/api.php?action=query&prop=extracts&format=json&titles=${query}&exintro=&explaintext=&redirects=&formatversion=2`);
|
||||
const data = response.body.query.pages[0];
|
||||
const description = data.extract.substr(0, 1900).split('\n').join('\n\n');
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0xE7E7E7)
|
||||
.setTitle(data.title)
|
||||
.setURL(`https://en.wikipedia.org/wiki/${title}`)
|
||||
.setURL(`https://en.wikipedia.org/wiki/${query}`)
|
||||
.setAuthor('Wikipedia', 'https://upload.wikimedia.org/wikipedia/en/thumb/8/80/Wikipedia-logo-v2.svg/1122px-Wikipedia-logo-v2.svg.png')
|
||||
.setDescription(description);
|
||||
return message.embed(embed);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { RichEmbed } = require('discord.js');
|
||||
const request = require('superagent');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class YouTubeCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -26,17 +26,10 @@ module.exports = class YouTubeCommand extends Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
}
|
||||
const video = args.video;
|
||||
const video = encodeURIComponent(args.video);
|
||||
try {
|
||||
const response = await request
|
||||
.get('https://www.googleapis.com/youtube/v3/search')
|
||||
.query({
|
||||
part: 'snippet',
|
||||
type: 'video',
|
||||
maxResults: 1,
|
||||
q: video,
|
||||
key: process.env.GOOGLE_KEY
|
||||
});
|
||||
const response = await snekfetch
|
||||
.get(`https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&maxResults=1&q=${video}&key=${process.env.GOOGLE_KEY}`);
|
||||
const data = response.body.items[0];
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0xDD2825)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { RichEmbed } = require('discord.js');
|
||||
const request = require('superagent');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class YuGiOhCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -23,9 +23,9 @@ module.exports = class YuGiOhCommand extends Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
}
|
||||
const card = encodeURI(args.card);
|
||||
const card = encodeURIComponent(args.card);
|
||||
try {
|
||||
const response = await request
|
||||
const response = await snekfetch
|
||||
.get(`http://yugiohprices.com/api/card_data/${card}`);
|
||||
const data = response.body.data;
|
||||
if (data.card_type === 'monster') {
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
{
|
||||
"languages": {
|
||||
"af": "Afrikaans",
|
||||
"am": "Amharic",
|
||||
"ar": "Arabic",
|
||||
"az": "Azerbaijani",
|
||||
"ba": "Bashkir",
|
||||
"be": "Belarusian",
|
||||
"bg": "Bulgarian",
|
||||
"bn": "Bengali",
|
||||
"bs": "Bosnian",
|
||||
"ca": "Catalan",
|
||||
"ceb": "Cebuano",
|
||||
"cs": "Czech",
|
||||
"cy": "Welsh",
|
||||
"da": "Danish",
|
||||
"de": "German",
|
||||
"el": "Greek",
|
||||
"en": "English",
|
||||
"eo": "Esperanto",
|
||||
"es": "Spanish",
|
||||
"et": "Estonian",
|
||||
"eu": "Basque",
|
||||
"fa": "Persian",
|
||||
"fi": "Finnish",
|
||||
"fr": "French",
|
||||
"ga": "Irish",
|
||||
"gd": "Scots Gaelic",
|
||||
"gl": "Galician",
|
||||
"gu": "Gujarati",
|
||||
"he": "Hebrew",
|
||||
"hi": "Hindi",
|
||||
"hr": "Croatian",
|
||||
"ht": "Haitian",
|
||||
"hu": "Hungarian",
|
||||
"hy": "Armenian",
|
||||
"id": "Indonesian",
|
||||
"is": "Icelandic",
|
||||
"it": "Italian",
|
||||
"ja": "Japanese",
|
||||
"jv": "Javanese",
|
||||
"ka": "Georgian",
|
||||
"kk": "Kazakh",
|
||||
"km": "Khmer",
|
||||
"kn": "Kannada",
|
||||
"ko": "Korean",
|
||||
"ky": "Kyrgyz",
|
||||
"la": "Latin",
|
||||
"lb": "Luxembourgish",
|
||||
"lo": "Loa",
|
||||
"lt": "Lithuanian",
|
||||
"lv": "Latvian",
|
||||
"mg": "Malagasy",
|
||||
"mhr": "Mari",
|
||||
"mi": "Maori",
|
||||
"mk": "Macedonian",
|
||||
"ml": "Malayalam",
|
||||
"mn": "Mongolian",
|
||||
"mr": "Marathi",
|
||||
"mrj": "Hill Mari",
|
||||
"ms": "Malay",
|
||||
"mt": "Maltese",
|
||||
"my": "Burmese",
|
||||
"ne": "Nepali",
|
||||
"nl": "Dutch",
|
||||
"no": "Norwegian",
|
||||
"pa": "Punjabi",
|
||||
"pap": "Papiamento",
|
||||
"pl": "Polish",
|
||||
"pt": "Portuguese",
|
||||
"ro": "Romanian",
|
||||
"ru": "Russian",
|
||||
"si": "Sinhalese",
|
||||
"sk": "Slovak",
|
||||
"sl": "Slovenian",
|
||||
"sq": "Albanian",
|
||||
"sr": "Serbian",
|
||||
"su": "Sundanese",
|
||||
"sv": "Swedish",
|
||||
"sw": "Swahili",
|
||||
"ta": "Tamil",
|
||||
"te": "Telugu",
|
||||
"tg": "Tajik",
|
||||
"th": "Thai",
|
||||
"tl": "Tagalog",
|
||||
"tr": "Turkish",
|
||||
"tt": "Tatar",
|
||||
"udm": "Udmurt",
|
||||
"uk": "Ukrainian",
|
||||
"ur": "Urdu",
|
||||
"uz": "Uzbek",
|
||||
"vi": "Vietnamese",
|
||||
"xh": "Xhosa",
|
||||
"yi": "Yiddish",
|
||||
"zh": "Chinese"
|
||||
}
|
||||
}
|
||||
@@ -1,47 +1,6 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const translator = require('custom-translate');
|
||||
const morse = {
|
||||
"a": ".-",
|
||||
"b": "-...",
|
||||
"c": "-.-.",
|
||||
"d": "-..",
|
||||
"e": ".",
|
||||
"f": "..-.",
|
||||
"g": "--.",
|
||||
"h": "....",
|
||||
"i": "..",
|
||||
"j": ".---",
|
||||
"k": "-.-",
|
||||
"l": ".-..",
|
||||
"m": "--",
|
||||
"n": "-.",
|
||||
"o": "---",
|
||||
"p": ".--.",
|
||||
"q": "--.-",
|
||||
"r": ".-.",
|
||||
"s": "...",
|
||||
"t": "-",
|
||||
"u": "..-",
|
||||
"v": "...-",
|
||||
"w": ".--",
|
||||
"x": "-..-",
|
||||
"y": "-.--",
|
||||
"z": "--..",
|
||||
"0": "-----",
|
||||
"1": ".----",
|
||||
"2": "..---",
|
||||
"3": "...--",
|
||||
"4": "....-",
|
||||
"5": ".....",
|
||||
"6": "-....",
|
||||
"7": "--...",
|
||||
"8": "---..",
|
||||
"9": "----.",
|
||||
".": ".-.-.-",
|
||||
"?": "..--..",
|
||||
",": "--..--",
|
||||
"'": ".----."
|
||||
};
|
||||
const { dictionary } = require('./morsemappings.json');
|
||||
|
||||
module.exports = class MorseCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -59,7 +18,7 @@ module.exports = class MorseCommand extends Command {
|
||||
prompt: 'What text would you like to convert to morse?',
|
||||
type: 'string',
|
||||
validate: content => {
|
||||
if (translator.letterTrans(content, morse, ' ').length < 1900) {
|
||||
if (translator.letterTrans(content, dictionary, ' ').length < 1900) {
|
||||
return true;
|
||||
}
|
||||
return 'Your text to encode is too long.';
|
||||
@@ -73,7 +32,7 @@ module.exports = class MorseCommand extends Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
}
|
||||
const text = args.text.toLowerCase();
|
||||
const encoded = translator.letterTrans(text, morse, ' ');
|
||||
const encoded = translator.letterTrans(text, dictionary, ' ');
|
||||
return message.say(encoded);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"dictionary": {
|
||||
"a": ".-",
|
||||
"b": "-...",
|
||||
"c": "-.-.",
|
||||
"d": "-..",
|
||||
"e": ".",
|
||||
"f": "..-.",
|
||||
"g": "--.",
|
||||
"h": "....",
|
||||
"i": "..",
|
||||
"j": ".---",
|
||||
"k": "-.-",
|
||||
"l": ".-..",
|
||||
"m": "--",
|
||||
"n": "-.",
|
||||
"o": "---",
|
||||
"p": ".--.",
|
||||
"q": "--.-",
|
||||
"r": ".-.",
|
||||
"s": "...",
|
||||
"t": "-",
|
||||
"u": "..-",
|
||||
"v": "...-",
|
||||
"w": ".--",
|
||||
"x": "-..-",
|
||||
"y": "-.--",
|
||||
"z": "--..",
|
||||
"0": "-----",
|
||||
"1": ".----",
|
||||
"2": "..---",
|
||||
"3": "...--",
|
||||
"4": "....-",
|
||||
"5": ".....",
|
||||
"6": "-....",
|
||||
"7": "--...",
|
||||
"8": "---..",
|
||||
"9": "----.",
|
||||
".": ".-.-.-",
|
||||
"?": "..--..",
|
||||
",": "--..--",
|
||||
"'": ".----."
|
||||
}
|
||||
}
|
||||
@@ -1,101 +1,7 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { RichEmbed } = require('discord.js');
|
||||
const request = require('superagent');
|
||||
const languages = {
|
||||
"af": "Afrikaans",
|
||||
"am": "Amharic",
|
||||
"ar": "Arabic",
|
||||
"az": "Azerbaijani",
|
||||
"ba": "Bashkir",
|
||||
"be": "Belarusian",
|
||||
"bg": "Bulgarian",
|
||||
"bn": "Bengali",
|
||||
"bs": "Bosnian",
|
||||
"ca": "Catalan",
|
||||
"ceb": "Cebuano",
|
||||
"cs": "Czech",
|
||||
"cy": "Welsh",
|
||||
"da": "Danish",
|
||||
"de": "German",
|
||||
"el": "Greek",
|
||||
"en": "English",
|
||||
"eo": "Esperanto",
|
||||
"es": "Spanish",
|
||||
"et": "Estonian",
|
||||
"eu": "Basque",
|
||||
"fa": "Persian",
|
||||
"fi": "Finnish",
|
||||
"fr": "French",
|
||||
"ga": "Irish",
|
||||
"gd": "Scots Gaelic",
|
||||
"gl": "Galician",
|
||||
"gu": "Gujarati",
|
||||
"he": "Hebrew",
|
||||
"hi": "Hindi",
|
||||
"hr": "Croatian",
|
||||
"ht": "Haitian",
|
||||
"hu": "Hungarian",
|
||||
"hy": "Armenian",
|
||||
"id": "Indonesian",
|
||||
"is": "Icelandic",
|
||||
"it": "Italian",
|
||||
"ja": "Japanese",
|
||||
"jv": "Javanese",
|
||||
"ka": "Georgian",
|
||||
"kk": "Kazakh",
|
||||
"km": "Khmer",
|
||||
"kn": "Kannada",
|
||||
"ko": "Korean",
|
||||
"ky": "Kyrgyz",
|
||||
"la": "Latin",
|
||||
"lb": "Luxembourgish",
|
||||
"lo": "Loa",
|
||||
"lt": "Lithuanian",
|
||||
"lv": "Latvian",
|
||||
"mg": "Malagasy",
|
||||
"mhr": "Mari",
|
||||
"mi": "Maori",
|
||||
"mk": "Macedonian",
|
||||
"ml": "Malayalam",
|
||||
"mn": "Mongolian",
|
||||
"mr": "Marathi",
|
||||
"mrj": "Hill Mari",
|
||||
"ms": "Malay",
|
||||
"mt": "Maltese",
|
||||
"my": "Burmese",
|
||||
"ne": "Nepali",
|
||||
"nl": "Dutch",
|
||||
"no": "Norwegian",
|
||||
"pa": "Punjabi",
|
||||
"pap": "Papiamento",
|
||||
"pl": "Polish",
|
||||
"pt": "Portuguese",
|
||||
"ro": "Romanian",
|
||||
"ru": "Russian",
|
||||
"si": "Sinhalese",
|
||||
"sk": "Slovak",
|
||||
"sl": "Slovenian",
|
||||
"sq": "Albanian",
|
||||
"sr": "Serbian",
|
||||
"su": "Sundanese",
|
||||
"sv": "Swedish",
|
||||
"sw": "Swahili",
|
||||
"ta": "Tamil",
|
||||
"te": "Telugu",
|
||||
"tg": "Tajik",
|
||||
"th": "Thai",
|
||||
"tl": "Tagalog",
|
||||
"tr": "Turkish",
|
||||
"tt": "Tatar",
|
||||
"udm": "Udmurt",
|
||||
"uk": "Ukrainian",
|
||||
"ur": "Urdu",
|
||||
"uz": "Uzbek",
|
||||
"vi": "Vietnamese",
|
||||
"xh": "Xhosa",
|
||||
"yi": "Yiddish",
|
||||
"zh": "Chinese"
|
||||
};
|
||||
const snekfetch = require('snekfetch');
|
||||
const { languages } = require('./languages.json');
|
||||
|
||||
module.exports = class TranslateCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -136,15 +42,10 @@ module.exports = class TranslateCommand extends Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
}
|
||||
const language = args.to.toLowerCase();
|
||||
const query = args.text;
|
||||
const query = encodeURIComponent(args.text);
|
||||
try {
|
||||
const response = await request
|
||||
.get(`https://translate.yandex.net/api/v1.5/tr.json/translate`)
|
||||
.query({
|
||||
key: process.env.YANDEX_KEY,
|
||||
lang: language,
|
||||
text: query
|
||||
});
|
||||
const response = await snekfetch
|
||||
.get(`https://translate.yandex.net/api/v1.5/tr.json/translate?key=${process.env.YANDEX_KEY}&lang=${language}&text=${query}`);
|
||||
const data = response.body;
|
||||
const translated = data.text[0];
|
||||
const langs = data.lang.split('-');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const request = require('superagent');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class WebhookCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -33,7 +33,7 @@ module.exports = class WebhookCommand extends Command {
|
||||
const text = args.text;
|
||||
try {
|
||||
await message.delete();
|
||||
await request
|
||||
await snekfetch
|
||||
.post(process.env.WEBHOOK_URL)
|
||||
.send({
|
||||
content: text
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const request = require('superagent');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class YodaCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -21,16 +21,13 @@ module.exports = class YodaCommand extends Command {
|
||||
if (message.channel.type !== 'dm') {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
}
|
||||
const text = args.text;
|
||||
const text = encodeURIComponent(args.text);
|
||||
try {
|
||||
const response = await request
|
||||
.get('https://yoda.p.mashape.com/yoda')
|
||||
const response = await snekfetch
|
||||
.get(`https://yoda.p.mashape.com/yoda?sentence=${text}`)
|
||||
.set({
|
||||
'X-Mashape-Key': process.env.MASHAPE_KEY,
|
||||
'Accept': 'text/plain'
|
||||
})
|
||||
.query({
|
||||
sentence: text
|
||||
});
|
||||
return message.say(`\u180E${response.text}`);
|
||||
}
|
||||
|
||||
@@ -25,12 +25,16 @@ module.exports = class UserInfoCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
run(message, args) {
|
||||
async run(message, args) {
|
||||
if (message.channel.type !== 'dm') {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
|
||||
}
|
||||
const user = args.user;
|
||||
let member = message.guild.member(user);
|
||||
if (!member) {
|
||||
member = await message.guild.fetchMember(user);
|
||||
}
|
||||
let stat;
|
||||
let color;
|
||||
switch (user.presence.status) {
|
||||
@@ -62,7 +66,7 @@ module.exports = class UserInfoCommand extends Command {
|
||||
.addField('**Joined Discord On:**',
|
||||
`${user.createdAt}\n${moment.duration(Date.now() - user.createdTimestamp).format('y[ years], M[ months], w[ weeks, and ]d[ days]')} ago.`, true)
|
||||
.addField('**Joined Server On:**',
|
||||
`${message.guild.member(user).joinedAt}\n${moment.duration(Date.now() - message.guild.member(user).joinedTimestamp).format('y[ years], M[ months], w[ weeks, and ]d[ days]')} ago.`, true)
|
||||
`${member.joinedAt}\n${moment.duration(Date.now() - member.joinedTimestamp).format('y[ years], M[ months], w[ weeks, and ]d[ days]')} ago.`, true)
|
||||
.addField('**Status:**',
|
||||
stat, true)
|
||||
.addField('**Playing:**',
|
||||
|
||||
@@ -47,7 +47,7 @@ module.exports = class InfoCommand extends Command {
|
||||
.addField('Library',
|
||||
'[discord.js](https://discord.js.org/#/)', true)
|
||||
.addField('Modules',
|
||||
'[commando](https://github.com/Gawdl3y/discord.js-commando), [zalgoize](https://github.com/clux/zalgolize), [superagent](https://github.com/visionmedia/superagent), [mathjs](http://mathjs.org/), [moment](http://momentjs.com), [moment-duration-format](https://github.com/jsmreese/moment-duration-format), [jimp](https://github.com/oliver-moran/jimp), [cheerio](https://cheerio.js.org/)')
|
||||
'[commando](https://github.com/Gawdl3y/discord.js-commando), [zalgoize](https://github.com/clux/zalgolize), [snekfetch](https://github.com/GusCaplan/snekfetch), [mathjs](http://mathjs.org/), [moment](http://momentjs.com), [moment-duration-format](https://github.com/jsmreese/moment-duration-format), [jimp](https://github.com/oliver-moran/jimp), [cheerio](https://cheerio.js.org/)')
|
||||
.addField('APIs',
|
||||
'[Wattpad](https://developer.wattpad.com/docs/api), [Wordnik](http://developer.wordnik.com/docs.html), [osu!](https://osu.ppy.sh/p/api), [memegen.link](https://memegen.link/), [Yugioh Prices](http://docs.yugiohprices.apiary.io/#), [YouTube Data](https://developers.google.com/youtube/v3/), [Yoda Speak](https://market.mashape.com/ismaelc/yoda-speak), [Discord Bots](https://bots.discord.pw/api), [Today in History](http://history.muffinlabs.com/#api), [jService](http://jservice.io/), [Strawpoll](https://github.com/strawpoll/strawpoll/wiki/API), [Urban Dictionary](https://github.com/zdict/zdict/wiki/Urban-dictionary-API-documentation), [OMDB](http://www.omdbapi.com/), [Yahoo Weather](https://developer.yahoo.com/weather/), [Yandex.Translate](https://translate.yandex.com/developers), [Wikipedia](https://en.wikipedia.org/w/api.php), [Google Static Maps](https://developers.google.com/maps/documentation/static-maps/)');
|
||||
return message.embed(embed);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<li><a href="https://github.com/Gawdl3y/discord.js-commando/">discord.js-commando</a></li>
|
||||
<li><a href="https://github.com/oliver-moran/jimp">JIMP</a></li>
|
||||
<li><a href="https://github.com/clux/zalgolize">zalgoize</a></li>
|
||||
<li><a href="https://github.com/visionmedia/superagent">superagent</a></li>
|
||||
<li><a href="https://github.com/GusCaplan/snekfetch">snekfetch</a></li>
|
||||
<li><a href="http://mathjs.org/">mathjs</a></li>
|
||||
<li><a href="http://momentjs.com">moment</a></li>
|
||||
<li><a href="https://github.com/jsmreese/moment-duration-format">moment-duration-format</a></li>
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
<li><a href="https://github.com/Gawdl3y/discord.js-commando/">discord.js-commando</a></li>
|
||||
<li><a href="https://github.com/oliver-moran/jimp">JIMP</a></li>
|
||||
<li><a href="https://github.com/clux/zalgolize">zalgoize</a></li>
|
||||
<li><a href="https://github.com/visionmedia/superagent">superagent</a></li>
|
||||
<li><a href="https://github.com/GusCaplan/snekfetch">snekfetch</a></li>
|
||||
<li><a href="http://mathjs.org/">mathjs</a></li>
|
||||
<li><a href="http://momentjs.com">moment</a></li>
|
||||
<li><a href="https://github.com/jsmreese/moment-duration-format">moment-duration-format</a></li>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const commando = require('discord.js-commando');
|
||||
const request = require('superagent');
|
||||
const snekfetch = require('snekfetch');
|
||||
const path = require('path');
|
||||
const client = new commando.Client({
|
||||
commandPrefix: ';',
|
||||
@@ -18,7 +18,6 @@ client.registry
|
||||
['randomimg', 'Random Image'],
|
||||
['avataredit', 'Avatar Manipulation'],
|
||||
['textedit', 'Text Manipulation'],
|
||||
['numedit', 'Number Manipulation'],
|
||||
['imageedit', 'Image Manipulation'],
|
||||
['search', 'Search'],
|
||||
['games', 'Games'],
|
||||
@@ -37,7 +36,7 @@ client.on('guildCreate', async(guild) => {
|
||||
const count = guilds.reduce((prev, val) => prev + val, 0);
|
||||
console.log(`[Count] ${count}`);
|
||||
try {
|
||||
const response = await request
|
||||
const response = await snekfetch
|
||||
.post('https://www.carbonitex.net/discord/data/botdata.php')
|
||||
.send({
|
||||
key: process.env.CARBON_KEY,
|
||||
@@ -49,7 +48,7 @@ client.on('guildCreate', async(guild) => {
|
||||
console.log(`[Carbon] Failed to post to Carbon. ${err}`);
|
||||
}
|
||||
try {
|
||||
const response = await request
|
||||
const response = await snekfetch
|
||||
.post(`https://bots.discord.pw/api/bots/${client.user.id}/stats`)
|
||||
.set({
|
||||
'Authorization': process.env.DISCORD_BOTS_KEY
|
||||
@@ -70,7 +69,7 @@ client.on('guildDelete', async(guild) => {
|
||||
const count = guilds.reduce((prev, val) => prev + val, 0);
|
||||
console.log(`[Count] ${count}`);
|
||||
try {
|
||||
const response = await request
|
||||
const response = await snekfetch
|
||||
.post('https://www.carbonitex.net/discord/data/botdata.php')
|
||||
.send({
|
||||
key: process.env.CARBON_KEY,
|
||||
@@ -82,7 +81,7 @@ client.on('guildDelete', async(guild) => {
|
||||
console.log(`[Carbon] Failed to post to Carbon. ${err}`);
|
||||
}
|
||||
try {
|
||||
const response = await request
|
||||
const response = await snekfetch
|
||||
.post(`https://bots.discord.pw/api/bots/${client.user.id}/stats`)
|
||||
.set({
|
||||
'Authorization': process.env.DISCORD_BOTS_KEY
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiaobot",
|
||||
"version": "24.5.0",
|
||||
"version": "25.0.0",
|
||||
"description": "A Discord Bot",
|
||||
"main": "shardingmanager.js",
|
||||
"scripts": {
|
||||
@@ -36,7 +36,7 @@
|
||||
"mathjs": "^3.11.0",
|
||||
"moment": "^2.18.1",
|
||||
"moment-duration-format": "^1.3.0",
|
||||
"superagent": "^3.5.2",
|
||||
"snekfetch": "^2.2.3",
|
||||
"zalgolize": "^1.2.4"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user