Distortion
A basic framework for guilded bots using touchguilded, for educational purposes
Usage:
main.ts
import { GuildedClient, ClientConstructorOptions } from '../lib/Client';
const settings: ClientConstructorOptions = {
token: 'Token_here',
prefix: '!' // or any prefix of your choice,
eventFolderPath: '../src/events' // or any dir of your choice default is /events/,
commandFolderPath: '../src/commands' // or any dir of your choice default is /commands/,
};
const client = new GuildedClient(settings);
client.start();
/commands/example.ts
import { Command } from '../../lib/Command';
import { GuildedClient } from '../../lib/Client';
import { Message, TextChannel } from 'touchguild';
export default class TestCommand implements Command {
name = 'test';
run(client: GuildedClient, message: Message<TextChannel>, args: string[]): void {
message.channel.createMessage({content:`testing`});
}
}
/events/example.ts
import { Event } from '../../lib/Event';
import { GuildedClient } from '../../lib/Client';
import { CommandsRegistry } from '../../lib/CommandsRegistry';
import { Message, TextChannel } from 'touchguild';
export default class TestEvent implements Event {
name = 'test';
async run(client: GuildedClient, message: Message<TextChannel>): Promise<void> {
console.log("Testing")
}
}
/* That's not a working event listener it's just a template */