Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions modules/help.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Message } from 'discord.js'
import { Command } from '../scepter'

export const help = async (message: Message, args: string[]) => {
const helpCommand = args[0]
const command: Command = message.client['loadedCommands'][helpCommand]

if (command == null) {
return message.channel.send(`Command not found: ${helpCommand}`)
}
return message.channel.send(`${helpCommand}: ${command.description}\n\
Examples: \`${command.examples.map(x => x)}\``)
}

export const name = 'help'
export const commands = [
{
name: 'help',
description: 'Shows info and usage details of a given command',
examples: ['s.help help'],
minArgs: 1,
maxArgs: 1,
run: help
}
]
2 changes: 1 addition & 1 deletion scepter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ if (!process.env.SCEPTER_DISCORD_TOKEN) {
client.login(process.env.SCEPTER_DISCORD_TOKEN)
.catch(console.error)

type Command = {
export type Command = {
name: string,
description: string,
examples: string[],
Expand Down