-
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 #2 from Atlanta/master
0.3.0
- Loading branch information
Showing
16 changed files
with
953 additions
and
574 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
/node_modules/ | ||
config.json | ||
config.json | ||
token.json | ||
credentials.json |
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
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,50 @@ | ||
const fs = require('fs'); | ||
const Discord = require('discord.js'); | ||
|
||
module.exports = { | ||
name: 'help', | ||
description: 'Shows all available commands.', | ||
alias: [ | ||
'commands' | ||
], | ||
args: [], | ||
/** | ||
* @param {Discord.Message} message | ||
* @param {string[]} args | ||
*/ | ||
execute(message, args) { | ||
const embed = new Discord.MessageEmbed() | ||
.setTitle('Commands') | ||
.setThumbnail(message.client.user.avatarURL()) | ||
.setDescription('<required parameter> [optional parameter] ...multiple parameter') | ||
; | ||
|
||
const client = message.client; | ||
client.commands = new Discord.Collection(); | ||
|
||
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js')); | ||
|
||
for (const file of commandFiles) { | ||
const command = require(`./${file}`); | ||
client.commands.set(command.name, command); | ||
} | ||
|
||
client.commands.forEach(command => { | ||
let aliases = ''; | ||
|
||
if (command.alias) { | ||
command.alias.forEach(alias => { | ||
aliases += `\`${alias}\` `; | ||
}); | ||
} | ||
|
||
let args = command.args ? command.args.join(' ') : ''; | ||
|
||
embed.addField( | ||
'`!' + command.name + (args !== '' ? ' ' + args : '') + '`', | ||
(aliases !== '' ? '*Alias:* ' + aliases + '\n' : '') + command.description | ||
); | ||
}); | ||
message.channel.send(embed); | ||
} | ||
}; |
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,34 @@ | ||
const Keyv = require('keyv'); | ||
const Discord = require('discord.js'); | ||
|
||
module.exports = { | ||
name: 'payday', | ||
description: 'Get/set the next payday date.', | ||
permission: 'ADMINISTRATOR', | ||
args: [ | ||
'[next-payday]' | ||
], | ||
/** | ||
* @param {Discord.Message} message | ||
* @param {string[]} args | ||
*/ | ||
async execute(message, args) { | ||
const db = new Keyv('sqlite://db/' + message.guild.id.toString() + '.sqlite'); | ||
|
||
if (args.length < 1) { | ||
const payday = await db.get('config.payday'); | ||
message.channel.send('Next payday: ' + payday + '.'); | ||
|
||
return; | ||
} | ||
|
||
if (!message.member.hasPermission(this.permission)) { | ||
return; | ||
} | ||
|
||
let payday = args[0]; | ||
await db.set('config.payday', payday); | ||
|
||
message.channel.send('Next payday set to ' + payday + '.'); | ||
}, | ||
}; |
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.
Oops, something went wrong.