A multi-purpose Discord bot written in Discord.js that does all sorts of bot stuff.
Can't find that one image your friend sent that got buried by a day's worth of messages? Well, you can now search for them! Powered by OCRSpace and Fuse.js. (Enter ;image
for more info.)
It's a real inconvenience when you need to open links just to watch epic fails or low quality memes. So now, the bot will automatically extract and send the video whenever someone sends a link! Powered by youtube-dl.1
Hang tight.
The invite link will be available once the bot gets out of beta.
New commands, new year bug fixes and updated discord.js to v13.5.1
- updated discord.js to v13.5.1
- moved the SendMsg class to its own folder
- new config entry for Oxford Dictionaries API
- fixed
extractVids
autoresponse not working - updated the
user
command to include the presence status and server timeout - added the
server
command to get all available info on the current server - forgot to remove the
isBeta
status on theimage
command, command should work now - added the
define
command which gives word definitions (powered by Oxford Dictionaries) - recategorized some commands
You can see past changelogs in the CHANGELOG.md file.
You can either use GET
or POST
.
Endpoint url for Xtrike Bot: https://xtrike-bot.xyr11.repl.co
Endpoint | Description | Returns |
---|---|---|
/stats | Get all bot statistics | Object |
/stats/keys | Get the different statistics keys | Array |
/stats/commandName /stats/ key |
Get the individual values of the given command name or property | String |
const isUp = await fetch('https://xtrike-bot.xyr11.repl.co').then(res => res.text()).catch(console.error)
console.log('The bot is up:', !!isUp)
const stats = await fetch('http://localhost:3000/stats').then(res => res.json()).catch(console.error)
console.log(stats)
- Git
- Node.js 16.6 or later (preferably the latest version)
- a MongoDB database
- an OCRSpace API key
- Replit account (optional)
- Oxford Dictionaries API ID and key (for the
oxford
command, optional)
If you're using Replit, click: .
If not, then clone the repository via Git by opening your console and entering the following commands:
cd "C:/path/of/repo/folder"
git clone https://github.com/xyr11/xtrike-bot.git && cd xtrike-bot
npm i
On https://discord.com/developers/applications, click "New Application". Add your application name and press "Create" to create a new application. You can set your bot description in this page.
After that, go to the "Bot" tab. Click the "Add Bot" button and press the confirmation button. After that, enable all privileged intents in the "Privileged Gateway Intents" tab so that the bot can properly fetch data. You can also set a custom bot name and bot avatar in this page.
After that, rename the example-config.js
file to config.js
and replace the values of all the required variables to configure your bot. There are comments to help you out.
If you're on Replit, press the big "Run" button.
If not, open your console and enter the following command to start your bot:
npm start
If no errors are encountered, you should be able to see the following message:
Ready as <Bot username>! 🤖 (<Date and time>)
You can customize the bot by replacing the default value of the optional variables on your config.js
file.
Documentation
Variable | Default value | Description |
---|---|---|
botPrefix |
"; " |
You can use more than 1 character here and any character except a space. This will have no effect if user used slash commands (if slash commands are deployed). |
botName |
"Xtrike Bot " |
Name of the bot. |
botDescription |
"Xtrike Bot is a multi-purpose bot. " |
Description of the bot. It can have multiple lines and Discord embed formatting. |
botColor |
"#E3E5E8 " |
Used for the color of embeds sent by the bot. Use a hex color value like "#RRGGBB". |
infoFields |
Check file | Info fields. This is an array of fields that will be shown in the ;info embed. Fields needs a name and value property, and they support Discord embed formatting too. |
botSupport |
N/A | User IDs of people that has the 'Bot Support' role. Right now they don't do anything but in the future this may change. |
errorLogging |
N/A | Channel ID for error logging. All errors caught will be send in the specified channel. Note that the error message may include personal info such as folder names. |
status |
"online " |
Presence status: online /idle /dnd /invisible . |
actType |
"playing " |
Activity type: playing /watching /listening /competing . |
actName |
";info " |
Activity name, the text that will show up in "Playing..." |
isMobile |
false |
If you want to set the status to "Online in mobile device". If true, this will ignore actType . |
To update the code, enter:
git fetch --all && git reset --hard origin/main && npm i
NOTE: This will overwrite all files that you have modified, so you will lose them. If you want it to be saved permanently then I suggest forking the repository instead and doing git merge
with your own version every time there is a new update.
To-do's for future versions
- Command that temporarily disables other commands
- Use a unified class for commands
- Get the total number of messages the bot has sent
- Endpoint will cache results every 30 seconds instead of requesting data every time someone visits
- More probably...
The code is licensed under MIT License.
Join the official support and dev Discord server!
Huge thank you to Worn Off Keys's discord.js playlist, to the An Idiot's Guide guide, and finally to Discord.js Guide, especially with the new and spicy v13 stuff. A huge thank also to Replit for the bot hosting.
Footnotes
-
Supported sites: Facebook, Twitter, Tiktok. DISCLAIMER: The bot only temporarily saves the videos generated from this feature so that it can be send on Discord. You are entirely responsible for any and all content generated from these links. ↩