A relatively simple Discord bot with random commands I needed, made with Deno, TS and Discord.JS.
Important
This bot was made as a learning project that I could use for personal use with friends. I have not made it user friendly to install it yourself. It is however licensed under the unlicense so you may use the code however you like.
Command | Description | Parameters | Availability | Preview |
---|---|---|---|---|
/ping |
Responds with "pong" | None | Everywhere | ![]() |
/remind |
Sends you a reminder in a dm. | - message : REQUIRED string; the message you'd like to send yourself.- date : REQUIRED string; either iso date or natural english date. Parsed using chrono, meaning that you can enter in 2h or tomorrow . |
Everywhere | ![]() ![]() |
/time |
Command to generate Discord Timestamps | - time : REQUIRED string; same as /remind .- type : REQUIRED autocompleted string; several options for the timestring, including relative, full date etc... |
Everywhere | ![]() |
/say |
Will say something as the bot. | You must specify one of these parameters. - content : string; the message.- json : string; parsed json, use this to add embeds. |
Everywhere | ![]() |
/coc |
Creates an ClashOfCode game and provides controls to start the game, and to make a new session. | - languages : REQUIRED autocompleted string; the allowed programming languages for the clash, comma seperated.- gamemodes : REQUIRED autocompleted string; different combinations of gamemodes. |
Everywhere | ![]() |
Typst | This set of commands allow you to type and compile typst code in discord. Useful for those moments where you're explaining math to someone. | Common parameters: - transparant : boolean; it'll set the background color of the png to transparant. Only compatible with discord dark mode as the text color will be set to white.- file : boolean; it'll attach the typst code as file. |
Everywhere | ![]() |
- /typst inline |
You can type one line of typst code within the input itself and it'll generate a picture out of it. | - code : REQUIRED string; the typst code.+ common parameters |
Everywhere | ![]() |
- /typst multiline |
A modal with a text input will be opened once you run this command so you can type multiple lines of typst code (up to 4000 chars) | + common parameters | Everywhere | ![]() |
Typescript Eval | Runs the provided typescript code. | Common parameters: - output : boolean; if enabled the bot will respond with the input+output of your code in public chat (not ephemeral). |
Nowhere (only configured userids may use it.) | ![]() |
- /ts inline |
Allow's for one line of typescript code. So you can either just run simple or minified code. | - code : REQUIRED string; ts code.+ common parameters |
Nowhere | ![]() |
- /ts multiline |
Opens a modal for longer codesnippets (again max length of 4000 characters). | + common parameters | Nowhere | ![]() |
Sexy | This collection of commands allows me and my friends to - Upload unappealing pictures of eachother to my server. - Send them (within my discord server) using my bot. This allows us to have a central place to store funny pictures of eachother. | Common parameters: - nickname : REQUIRED autocompleted string; the nickname under which the photos are stored- public : bool; makes the message not ephemeral. |
At specified guilds | ![]() |
- /sexy carousel |
Displays the pictures in a 4x4 grid with scrolling buttons on the bottom | - page : autocompleted number; specifies the page the carousel should start at.+ common parameters |
At specified guilds | ![]() |
- /sexy image |
Allows you to pick one image to send. | - image : REQUIRED autocompleted string; specifies the iamge that should be displayed.+ common parameters |
At specified guilds | ![]() |
- /sexy-upload |
Uploads the specified image to the server's filesystem. | - nickname : REQUIRED autocompleted string; the nickname under which the photos are stored- filename : REQUIRED string; a name that should describe the image.- image : REQUIRED asset; the image file. |
At specified guilds | ![]() |
LastFM | These commands show what song you or a lastfm user is currently playing | None | Everywhere | ![]() |
/fm np |
Gets the currently playing song of either your lastfm username or the provided one. | - username : string; overwrites the lastfm username. |
Everywhere | ![]() |
/fm set |
Sets your lastfm user. It alsoc ckecks if the provided username exists. | - username : REQUIRED string; the username that will be set in the database. |
Everywhere | ![]() |
- Required
- Deno
- Git
- Port forwarding / a different solution to get the web server online.
- Optional
- Typst
git clone https://github.com/jsw08/dcbot
cd dcbot
deno i
This program works using dotenv. So you can either place a .env file in the project root, or set the environment variables. See the template file.
- Make sure you have your environment variables set.
- Run
deno run -A ./src/main.ts