This is a Discord bot built with TypeScript and the Discord.js library. The bot includes several commands and is designed to be easily extendable.
-
Slash Commands: The bot supports various slash commands, including:
/server
: Provides information about the server./user
: Provides information about the user./textfield
: Allows users to input custom text./testcommand
: Replies with an embedded message.
-
Command Cooldowns: Implemented cooldowns for commands to prevent spam.
-
Environment Configuration: Uses dotenv for managing environment variables.
- Node.js (version 16 or higher)
- A Discord bot token (create a bot on the Discord Developer Portal)
-
Clone the repository:
git clone https://github.com/YOUR_USERNAME/TypeScriptProject.git cd TypeScriptProject
-
Install dependencies:
npm install
-
Create a
.env
file in the root directory and add your Discord bot token and other necessary environment variables:DISCORD_TOKEN=your_bot_token DISCORD_CLIENT_ID=your_client_id GUILD_ID=your_guild_id
To run the bot in development mode with automatic reloading:
### Build
To compile the TypeScript code to JavaScript:
```bash
npm run build
To start the bot:
npm start
To deploy the slash commands to your Discord server:
npm run deploy
Contributions are welcome! Please feel free to submit a pull request or open an issue.
This project is licensed under the MIT License - see the LICENSE file for details.
- Discord.js - A powerful library for interacting with the Discord API.
- TypeScript - A superset of JavaScript that compiles to clean JavaScript output.
- dotenv - A zero-dependency module that loads environment variables from a
.env
file.