mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
mal-badges Command
This commit is contained in:
@@ -136,7 +136,7 @@ in the appropriate channel's topic to use it.
|
||||
|
||||
## Commands
|
||||
|
||||
Total: 414
|
||||
Total: 415
|
||||
|
||||
### Utility:
|
||||
|
||||
@@ -316,6 +316,7 @@ Total: 414
|
||||
* **know-your-meme:** Searches Know Your Meme for your query.
|
||||
* **league-of-legends:** Responds with information on a League of Legends champion.
|
||||
* **lyrics:** Responds with lyrics to a song.
|
||||
* **mal-badges:** Responds with a MyAnimeList user's mal-badges badge.
|
||||
* **manga:** Searches AniList for your query, getting manga results.
|
||||
* **map:** Responds with a map of a specific location.
|
||||
* **mayo-clinic:** Searches Mayo Clinic for your query.
|
||||
@@ -951,6 +952,8 @@ here.
|
||||
* mad-libs (Original Game)
|
||||
- [Mad:)Takes](https://www.madtakes.com/index.php)
|
||||
* mad-libs (Mad Libs Data)
|
||||
- [mal-badges](http://www.mal-badges.net/)
|
||||
* mal-badges (API)
|
||||
- [MangaGamer.com](https://www.mangagamer.com/)
|
||||
* box-choosing ([Original Translation](https://store.steampowered.com/app/526490/Higurashi_When_They_Cry_Hou__Ch4_Himatsubushi/))
|
||||
- [Marvelous](http://www.marv.jp/)
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const request = require('node-superfetch');
|
||||
|
||||
module.exports = class MalBadgesCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'mal-badges',
|
||||
aliases: ['my-anime-list-badges', 'mal-badge', 'my-anime-list-badge'],
|
||||
group: 'search',
|
||||
memberName: 'mal-badges',
|
||||
description: 'Responds with a MyAnimeList user\'s mal-badges badge.',
|
||||
credit: [
|
||||
{
|
||||
name: 'mal-badges',
|
||||
url: 'http://www.mal-badges.net/',
|
||||
reason: 'API'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
prompt: 'What user would you like to get the badge of?',
|
||||
type: 'string',
|
||||
parse: user => encodeURIComponent(user)
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
try {
|
||||
const { body } = await request.get(`http://www.mal-badges.net/users/${user}/badge`);
|
||||
const embed = new MessageEmbed()
|
||||
.attachFiles([{ attachment: body, name: 'badge.png'} ])
|
||||
.setTitle(user)
|
||||
.setImage('attachment://badge.png')
|
||||
.setURL(`http://www.mal-badges.net/users/${user}`)
|
||||
.setColor(0x00ADB5);
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
if (err.status === 404 || err.status === 500) {
|
||||
return msg.say(`Could not find any results. Try updating at <http://www.mal-badges.net/users/${user}>.`);
|
||||
}
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "114.6.3",
|
||||
"version": "114.7.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user