This repository has been archived by the owner on Aug 29, 2019. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from project-yuigahama/next
v1.0.6-pre
- Loading branch information
Showing
13 changed files
with
156 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const { Command, KlasaMessage, RichDisplay } = require('klasa') | ||
const { MessageEmbed } = require('discord.js') | ||
const fetch = require('node-fetch') | ||
|
||
class TruckersMP extends Command { | ||
constructor (...args) { | ||
super(...args, { | ||
enabled: true, | ||
requiredPermissions: ['MANAGE_MESSAGES'], | ||
description: language => language.get('COMMAND_TRUCKERS_MP_DESCRIPTION') | ||
}) | ||
} | ||
|
||
/** | ||
* @param {KlasaMessage} message | ||
*/ | ||
async run (message) { | ||
const data = await fetch('https://stats.truckersmp.com/api/v4/overall.json').then(res => res.json()).catch(() => null) | ||
if (data === null) throw new Error('Request failed.') | ||
if (data.error === true) return message.sendMessage('Error.') | ||
const Display = new RichDisplay() | ||
|
||
for (let index = 0; index < data.color.length; index++) { | ||
const color = data.color[index] | ||
const embed = new MessageEmbed().setColor(color) | ||
const server = data.data[index] | ||
embed.setTitle(server.name).addField('Players', server.players, true).addField('Max Players', server.max_players, true) | ||
Display.addPage(embed) | ||
} | ||
|
||
return Display.run(message) | ||
} | ||
} | ||
|
||
module.exports = TruckersMP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const { Command, KlasaMessage } = require('klasa') | ||
const { MessageEmbed, GuildEmoji } = require('discord.js') | ||
|
||
module.exports = class extends Command { | ||
constructor (...args) { | ||
super(...args, { | ||
runIn: ['text'], | ||
description: language => language.get('COMMAND_EMOJI_INFO_DESCRIPTION'), | ||
usage: '<emoji:emoji>' | ||
}) | ||
} | ||
|
||
/** | ||
* @param {KlasaMessage} message | ||
* @param {[GuildEmoji]} usage | ||
*/ | ||
async run (message, [emoji]) { | ||
const Embed = new MessageEmbed() | ||
.setColor('RANDOM') | ||
.setThumbnail(emoji.url) | ||
.addField('Emoji name', emoji.name, true) | ||
.addField('ID', emoji.id, true) | ||
.addField('Animated', emoji.animated ? 'Yes' : 'No', true) | ||
.addField('Deleted', emoji.deleted ? 'Yes' : 'No', true) | ||
.setFooter('Created At') | ||
.setTimestamp(emoji.createdTimestamp) | ||
|
||
const author = await emoji.fetchAuthor().catch(() => null) | ||
|
||
if (author === null) return message.sendEmbed(Embed) | ||
else return message.sendEmbed(Embed.setAuthor(`${author.tag} has added.`, author.avatarURL({ format: 'png' }))) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters