Skip to content
generated from snowcrystals/template

Just like any other Discord.js framework, but better. 🧊

License

Notifications You must be signed in to change notification settings

snowcrystals/iglo

Repository files navigation

@snowcrystals/iglo

Just like any other Discord.js framework, but better. 🧊

Version License: MIT


Information

@snowcrystals/iglo is a Discord.js framework which makes building a bot a lot easier. With its built-in SlashCommand registry system it checks updates the data once a change to the command is detected (a restart is required if code changes are made). The framework currently only supports SlashCommands (no idea why you want to use message commands now that Discord restricted the content to only a limited amount of eligible bots).

Install

yarn add @snowcrystals/iglo
npm install @snowcrystals/iglo

Documentation

The documentation (API Reference) can be found on our website

Examples

The following examples are written in TypeScript with decorators enabled. The examples do not show the required imports (because the only imports you will need are @snowcrystals/iglo components).

For a non-decorator version, use a constructor and move the options to the super function inside the constructor (example below)

class Command extends SlashCommand {
	constructor(client) {
		super(client, options); // <-- Options are the options from the decorator
	}
}

Command Example

@ApplyOptions<CommandOptions>({
	name: "test",
	description: "Replies with 'Hello World!'"
})
class Command extends Command {
	public async run(interaction: CommandInteraction) {
		await interaction.reply("Hello World!");
	}
}

SubCommand Example

@ApplyOptions<SubCommandOptions>({
	name: "test",
	description: "Replies with 'Hello World!'",
	options: [
		{
			name: "world",
			description: "A very cool command",
			type: ApplicationCommandOptionType.Subcommand
		}
	],
	subcommands: [
		{
			name: "world",
			functionName: "world"
		}
	]
})
class Command extends SubCommand {
	public async world(interaction: CommandInteraction) {
		await interaction.reply("Hello World!");
	}
}

EventListener Example

@ApplyOptions<EventListenerOptions>({
	name: "ready",
	once: true
})
export class ReadyEvent extends EventListener {
	public run() {
		void this.client.commandHandler.registry.start();
		this.client.logger.info(`(Bot): Connected to Discord as ${bold(this.client.user?.tag ?? "")}.`);
	}
}

InteractionListener Example

@ApplyOptions<InteractionListenerOptions>({
	name: "modal",
	type: InteractionType.ModalSubmit
})
export default class extends InteractionListener {
	public async run(interaction: ModalSubmitInteraction) {
		const title = interaction.fields.getTextInputValue("contact-title");
		const description = interaction.fields.getField("contact-description");

		console.log(title, description);
		await interaction.reply({
			content: "Data received",
			ephemeral: true
		});
	}
}

Author

πŸ‘€ ijsKoud

Donate

This will always be open source project, even if I don't receive donations. But there are still people out there that want to donate, so if you do here is the link PayPal or to Ko-Fi. Thanks in advance! I really appriciate it <3

License

Project is licensed under the Β© MIT License


About

Just like any other Discord.js framework, but better. 🧊

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages