easydcbot v1.1.2
Package to make discord bots "easier". It is still not quite easy but yeah, well this was more of a fun project rather than a serious one, so if there are updates... it's kinda weird
Basics
Login
You can use the login() function for this.
const easybot = require("easydcbot")
//Highly recommended to put the rest of the code here
easybot.login("your bot's token here")
Client options
if you want to set some rules / important stuff like prefix and or if the bot listens to other bot's messages or not, you will use the options() function, these are the params you can use for options (remember that all of these are optional!):
const easybot = require("easydcbot")
easybot.options({ prefix: "Your prefix", botcensor: true })
// first we have the prefix, if you want to make a per guild prefix, you might wanna see the rest of this readme. And the botcensor censors all of the messages sent by a bot, this can be usefull to prevent spam!
easybot.login("your bot's token here")
Creating a command
To create a command, you can use the command() function, where you need to type the name of the command, followed by the type of the command and finally some options.
Reply only command
To make a reply only command, you will use the message option, so:
const easybot = require("easydcbot")
easybot.options({ prefix: "Your prefix", botcensor: true })
easybot.command("mycommandinlowercase", "response", {
message: "You can send a raw message or an embed with the embed() function (read the rest of the read me)"
})
easybot.login("your bot's token here")
What if i want to use an embed?
Well, if you want to use an embed, you can use the embed() function with the options inside, here is an example:
const easybot = require("easydcbot")
easybot.command("mycommand", "response", {
message: easybot.embed({
title: "title",
description: "description"
})
})
easybot.login("your bot's token here")
CommandTypes
Here are all the command types:
response
- Only reply, there will not be any actuall function other then sending the message.responseWithAction
- Reply + An action, the options to do that are:
{
message: "Message",
action: `Anything else that is not only sending the message`
}
action
- Only does an action, never replies, it just does something that is not sending a message, the option required is:
{
action: `Some function`
}
EmbedProperties
All the properties inside the options:
title: "title"
- Some title you want on the embed.description: "description"
- Description of the embedcolor: "Color"
- You can search "color picker" on google and choose your favourite color, then just copy the hex code and paste it inside the ""footer: "Footer"
- Footer of the embedthumbnail: "URL for the thumbnail image"
- It needs to be an URL!image: "URL for the embed image"
- It also needs to be an URL!addField: {title: "Something", description: "Something", inline: false}
- Embed fields
Database (BETA)
About the database... You can use the package quick.db directly, because the database used for easydcbot is quick.db, or you can try our BETA functions for the same database, so you can just use database.something() that hopefully it works...
get(id)
const easybot = require("easydcbot")
easybot.database.get("id")
add(id, value)
const easybot = require("easydcbot")
easybot.database.add("id", value)
set(id, value)
const easybot = require("easydcbot")
easybot.database.set("id", value)
delete(id)
const easybot = require("easydcbot")
easybot.database.delete("id")
subtract(id, value)
const easybot = require("easydcbot")
easybot.database.subtract("id", value)
Important!
I just want to say that this entire project is not a serious one / super complex, it was really simple to create and it was just for fun, if you really want to make a discord bot in the easy way, i should recommend some tutorials, and some code:
Links
-- Some v12 tutorials i found --
https://www.youtube.com/watch?v=8qvO24Uqfps
https://www.youtube.com/watch?v=mAR40iA88cI
https://www.youtube.com/watch?v=4Np2fJOdXjE
-- This is the v12 best tutorials i recommend --
https://www.youtube.com/watch?v=k5BspQ9Czek
https://www.youtube.com/watch?v=wZbAinOmays
-- This is a v13 tutorial --
https://www.youtube.com/watch?v=xWxiFUFSMB0
What is the difference between v12 and v13?
- v12 is way easier to learn, although there are not as many functions as v13, also it is harder to do slash commands with v12.
- v13 in the other hand, is harder to learn but there are some functions that v12 doesn't have, that can be essential for modern commands. Also it is a little easier to do slash commands. The main problem comes to repl and glitch users which they have to perform a dev command to get node v16 which is required by the package itself.
Tutorial code
discord.js v12:
const Discord = require("discord.js")
const client = new Discord.Client()
client.on("message", message => {
let prefix = "your prefix"
if(message.author.bot) return;
if(message.content.toLowerCase() === prefix + "mycommandinlowercase") {
message.channel.send("Something")
//any other functions you want to do on your command!
}
})
client.login("your token")
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago