Skip to content

Instantly share code, notes, and snippets.

@5factor
Created April 25, 2021 20:11
Show Gist options
  • Save 5factor/4cb2e562bc8e3749077c96e738ec2234 to your computer and use it in GitHub Desktop.
Save 5factor/4cb2e562bc8e3749077c96e738ec2234 to your computer and use it in GitHub Desktop.
import { Client, Collection } from "discord.js";
export class Command {
constructor(public client: Client, options) {
this.client = client;
this.help = {
name: options.name || null,
description: options.description || "No information specified.",
usage: options.usage || [],
};
this.conf = {
permLevel: options.permLevel || 0,
cooldown: options.cooldown || 0,
aliases: options.aliases || [],
allowDMs: options.allowDMs || false,
args: options.args ||
};
this.cooldown = new Collection();
}
setCategory(category) {
this.help.category = category;
}
startCooldown(guild, user) {
if (!this.cooldown.get(guild)) this.cooldown.set(guild, new Set());
this.cooldown.get(guild).add(user);
setTimeout(() => {
this.cooldown.get(guild).delete(user);
}, this.conf.cooldown);
}
setMessage(message) {
this.message = message;
}
send(message) {
this.message.channel.send(message);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment