CSUN Discord Textbot

Project Summary

Currently being used in my school’s (CSUN) Discord server which hosts 3000 users. I used the Discord API to develop a text-bot programmed in JavaScript to play games and interact with users like playing in a simulated stock market, connect four, Pokémon, Akinator, find the IMBD results of a movie, find the lyrics to a song, etc.

Tools, libraries, frameworks, etc.

JavaScript, Node.Js, MongoDB, Mongoose, Discord.js

Project Description

Currently, the bot is on its 3rd iteration. The first two iterations were programmed in Python. After reviewing the Discord.js library and its capabilities I decided to transition to JavaScript.

The bot uses MongoDB to store user details, server details, and movies for movie night. Below there are the commands with details on what they are. Some noteable commands would be the Akinator command to play an Akinator game with the bot, the connect-4 command to play a game with any other user, and finally the Pokémon command.

The Pokémon command while not currently finished allows each user to catch various Pokémon that spawns, battle Pokémon to train your Pokémon, and battle other users to glory and money. Currently, only the first generation of Pokémon and types are implemented.

⇨ ~help
Displays all commands for this bot

~help [command name] - Use a command name as an argument to display details for a command

Server Only: No   Cooldown: 10 Seconds   Aliases: ~botinfo, ~info, ~commands

⇨ ~maps
Displays all subcommands for this command

~maps [desired map] - Use a map name as an argument to display that map

subcommands: campus, housing, shuttle, water, lactation

Server Only: No   Cooldown: 5 Seconds   Aliases: ~m, ~map

⇨ ~ping
Use to check if bot is active

Server Only: No   Cooldown: 1 Seconds   Aliases: ~test

⇨ ~server-info
Displays the info for the server

Server Only: Yes   Cooldown: 30 Seconds   Aliases: ~serverinfo, server-details, server-details, serverdtls

⇨ ~user-info [@user]
Displays the info for the user

Server Only: Yes   Cooldown: 5 Seconds   Aliases: ~userinfo, ~user-details, ~userdetails, ~userdtls, usrdtls

⇨ ~akinator
Start an Akinator game where the bot will guess what your thinking.

Server Only: No   Cooldown: 2 Seconds   Aliases: ~ak

⇨ ~coinflip
Flips a coin for you

~coinflip [number] - Use a number to tell the bot how many coins to flip

Server Only: No   Cooldown: 5 Seconds   Aliases: ~coin-flip, ~flip-coin, ~flip

⇨ ~connect-four
Displays all subcommands for this command

~connect-four [challenge] [@player] - Use a subcommand to challenge, play, or resign

subcommands: challenge, place, resign, draw

Server Only: No   Cooldown: 2 Seconds   Aliases: ~c4, ~connect, ~cfour, ~connect

⇨ ~dice
Rolls a dice for you

~dice [number] - Choose the number of dice you want to roll

Server Only: No   Cooldown: 0.1 Seconds   Aliases: ~dice-roll, ~rolldice
⇨ ~joke
Prints a joke

Server Only: No   Cooldown: 5 Seconds   Aliases: ~gibfunny, ~tellajoke

⇨ ~pokemon
In development
⇨ ~rateme
Will rate the user

Server Only: No   Cooldown: 5 Seconds   Aliases: ~rate

⇨ ~stock
Displays subcommands for the stock command

~buy [portfolio number] [ticker] [amount (usd)] - Use a subcommand to buy, sell and check your portfolio

subcommands: buy, sell, price, watchlist, portfolio

Server Only: Yes   Cooldown: 2 Seconds   Aliases: ~stocks, ~s

⇨ ~imdb [movie name]
Displays the imdb results of the movie

Server Only: No   Cooldown: 5 Seconds   Aliases: ~imbd

⇨ ~lyrics [song name]
Prints the song lysics from Genius

Server Only: No   Cooldown: 5 Seconds   Aliases: ~lyric, ~song, ~songDetails

⇨ ~matty
Displays a picture of Matty

Server Only: No   Cooldown: 5 Seconds   Aliases: ~whoismatty

⇨ ~movies
Displays subcommands for movie command

~list - Use a subcommand to print 10 random movies or add/remove movie to database

subcommands: list, add, remove, check, show

Server Only: Yes   Cooldown: 0.,2 Seconds   Aliases: ~movie

⇨ ~onceamatador
Always a Matador!

Server Only: No Yes   Cooldown: 5 Seconds   Aliases: ~oam

⇨ ~reddit [subreddit/category] [is this a subreddit]
Displays an image from the subreddit or category

Server Only: Yes   Cooldown: 5 Seconds   Aliases: ~red, ~redit

⇨ ~say [anything]
Repeats anything you say

Server Only: No   Cooldown: 5 Seconds   Aliases: ~repeat

⇨ ~suggestions [suggestion]
Sends a suggestion to the mod team

Server Only: Yes   Cooldown: 0.1 Seconds   Aliases: ~suggest, ~please, ~suggestion, ~complaint, ~complain

⇨ ~ban [@user] [reason]
Bans someone from the server

Server Only: Yes   Cooldown: 10 Seconds   Aliases: ~remove, ~delete

⇨ ~kick [@user] [reason]
Kicks someone from the server

Server Only: Yes   Cooldown: 5 Seconds   Aliases: ~boot

⇨ ~prune [number of messages]
Deletes 2-100 messages from the channel

Server Only: Yes   Cooldown: 10 Seconds   Aliases: ~deletemessages, deletemessage, prunemessage

⇨ ~reload [command name]
Reload a command file, helpful for testing

Server Only: Yes   Cooldown: 10 Seconds   Aliases: ~restart, ~reboot, ~reset

⇨ ~reload-bot
Restarts the bot if using PM2, else ends the node process

Server Only: Yes   Cooldown: 10 Seconds   Aliases: ~reset-bot, restart-bot, reboot-bot

⇨ ~updaterole
Updates the user's school year role

Server Only: Yes   Cooldown: 18 days   Aliases: ~updateyear, ~updateme