Discord bot for Steam integration.
git clone https://github.com/M16-Dev/steam-bot.git
cd steam-botCopy the .env.example file to .env and fill in the required values:
cp .env.example .envTo automatically run formatting, linting, and tests before each commit:
deno task install-hooksdeno task devdeno task dev- Run in development mode with hot-reloaddeno task start- Run in production modedeno task deploy- Deploy slash commands to Discorddeno task format- Format codedeno task format:check- Check formatting without making changesdeno task lint- Run linterdeno task test- Run testsdeno task check- Run format check, linter, and tests (all at once)deno task install-hooks- Install Git pre-commit hooks
src/
├── commands/ # Slash commands (auto-loaded)
│ ├── ping.ts
│ └── general/
│ └── ping2.ts
├── events/ # Discord events (auto-loaded)
│ ├── ready.ts
│ └── interactionCreate.ts
├── components/ # Interactive components (auto-loaded)
│ ├── buttons/
│ ├── modals/
│ └── select-menus/
├── interactionHandlers/ # Interaction logic grouped and exported to functions for reuse
├── services/ # APIs and business logic
├── utils/ # Helper functions
├── types/ # TypeScript type definitions
├── loaders/ # Auto-loading system
└── bot.ts # Main bot class
Create a file in src/commands/:
import { SlashCommandBuilder } from "discord.js";
import type { Command } from "../../types/command.ts";
export default {
data: new SlashCommandBuilder()
.setName("mycommand")
.setDescription("My command description"),
async execute(interaction) {
await interaction.reply("Hello!");
},
} satisfies Command;Then deploy: deno task deploy
Create a file in src/events/:
import type { Event } from "../types/event.ts";
export default {
name: "messageCreate",
async execute(message) {
// Handle the event
},
} satisfies Event<"messageCreate">;Create a file in src/components/buttons/:
import type { Component } from "../../types/component.ts";
export default {
customId: "my-button",
async execute(interaction) {
await interaction.reply("Button clicked!");
},
} satisfies Component;You can also use MessageComponentCollectors for creating actions for components without defining them in /components. In such case, remember to prefix their customID with '$' to mark them as handled locally by MessageComponentCollector and to implement rate limiting.
All files are automatically loaded on bot startup!
After installing hooks (deno task install-hooks), the following will run automatically before each commit:
- ✅ Format check
- ✅ Linter
- ✅ Tests
If any of these steps fail, the commit will be blocked.