1
0
Fork 0

Command stuff

refactor/models
Bsian 2019-10-14 23:02:04 +01:00
parent 83edaf8281
commit 1dd2052b0c
No known key found for this signature in database
GPG Key ID: 097FB9A291026091
2 changed files with 38 additions and 0 deletions

21
src/class/Command.ts Normal file
View File

@ -0,0 +1,21 @@
import { Message } from 'eris'
import Client from '../Client'
export default class Command {
name: string
description?: string
usage?: string
enabled: boolean
aliases?: string[]
client: Client
permissions?: { roles: string[], users: string[] }
public run (message: Message, args: string[]) {}
constructor(client: Client) {
this.name = 'None'
this.description = 'No description given'
this.usage = 'No usage given'
this.enabled = false
this.aliases = []
this.client = client
}
}

17
src/commands/ping.ts Normal file
View File

@ -0,0 +1,17 @@
import Command from '../class/Command'
import Client from '../Client'
import { Message } from 'eris'
export default class Ping extends Command {
constructor(client: Client) {
super(client)
this.name = 'ping'
this.description = 'Pings the bot'
}
public async run (message: Message) {
const clientStart: number = Date.now()
const msg: Message = await message.channel.createMessage('🏓 Pong!')
msg.edit(`🏓 Pong!\nClient: \`${Date.now() - clientStart}ms\`\nResponse: \`${msg.createdAt - message.createdAt}ms\``)
}
}