DiscBot is a simple and easy-to-use Discord Bot instruction builder. It uses Discord.py which is for python.
ping:
say("Pong!")
say(concat("Latency: ", latency()))
wget https://github.com/dlvdls18/DiscBot.git
pip install discord.py |— res
| |— token.txt
|— src
| |— Bot.dbot
|— base.py
|— lang.py
|— README.md
|— export.py
|— temp.py
say:
say(message(1))
say(concat("- ", mention())
You need to learn about dbot language.
DBot uses python and convert itself to python.
DBot Files are placed in src/
You don't need to indent when using DBot, It automatically indent for you.
DBot have 2 parts:
- Commands
- Objects
With these parts, you can create a dbot language. It is very simple and easy to learn.
The format of a command is command_name:.
Command will be executed if it matches the user message.
ping:
say("Pong!")
say("Latency: ", latency())
coinflip:
if(equals(random(1, 2), 1))
say("Head")
else()
say("Tail")
end()
me:
say(mention())
say:
say(message(1))
say(concat("- ", mention())
If you want to make your bot respond when a
user use the command --status, create a command named --status:
--status:
say("Active!")
Objects can be inside the commands or inside the listener.
The format of an object is obj_name(args).
set("random", random(1, 3))
if(equals(get("random"), 1))
say("Rock")
elseif(equals(get("random"), 2))
say("Paper")
else()
say("Scissors")
end()
Objects are instructions for the bot, you can:
- send and edit a message
say("Hello!") - check for conditions
if(and(true, not(equals(2, 5)))) - save and load variables
set("hello", "world") - do math
div(add(3, multi(80, 9)), 2)and more.
Listener is a command without a name. meaning that listener will be executed whenever a user say something. Listener is executed after the commands.
To add objects to the listener, add it before the command.
say("Okay") <-- In listener
ping:
say("Pong!") <-- Not in listener
This translate your dbot files to python and export them.
Paste your bot token in res/token.txt.
Without this, an error will raise.
Take a look at https://discord.com/developers/applications/.
To export your bot files, run the file export.py.
This will translate dbot files and copy to dev/.
Other files and folders will not be translated since it's not a dbot file. You need to manually copy the other files and folders. Also, dbot files inside a folder does not translate too.
I will improve export.py soon.
Send a message.
String - message to send
Integer - message id
Edit a message
Integer - message id String - text
Check if the message is edited
Integer - message id
Boolean
Get the message
String - message
Get the author's mention NOTE: Using @myname will not work.
String - mention text
Get the author name
String - username
Get the channel name
String - channel name
Set a variable
String - name Any - value
Set a variable
String - name
Any - value
Check if arg1 and arg2 are equal
Any - arg1 Any - arg2
Boolean - equal
Check if the arg1 is greater than arg2
Any - arg1 Any - arg2
Boolean - greater
Check if arg1 is lesser than arg2
Any - arg1 Any - arg2
Boolean - lesser
Toggle the boolean
Boolean - arg1
Boolean - result
Check if arg1 and arg2 is true
Boolean - arg1 Boolean - arg2
Boolean - result
Check if arg1 or arg2 is true
Boolean - arg1 Boolean - arg2
Boolean - result
Check if the arg1 contains arg2
String - arg1 String - arg2
Boolean - result
Add 2 numbers
Integer - num1 Integer - num2
Integer - result
Subtract 2 numbers
Integer - num1 Integer - num2
Integer - result
Multiply 2 numbers
Integer - num1 Integer - num2
Integer - result
Divide 2 numbers
Integer - num1 Integer - num2
Integer - result
Modulo 2 numbers
Integer - num1 Integer - num2
Integer - result
Increment number
Integer - num1
Integer - result
Decrement number
Integer - num1
Integer - result
Execute the objects when condition is true
Boolean - condition
Execute the objects when condition is true
Boolean - condition
Execute the objects when the last condition is false
Ignore error
Execute when error is raised
End a statement
Pass a statement
Define a function
String - name
Call a function
String - name
Get the length of given argument
Any - arg1
Integer - length
Get the type of given argument
Any - arg1
String - type
Convert integer to ASCII character
Integer - arg1
String - char
Cut a string by it's start and end index
String - text Integer - start Integer - end
String - text
Cut the spaces from start and end
String - text
String - text
Get a random number
Integer - min Integer - max
Integer - num
Convert text to lowercase
String - text
String - text
Convert text to uppercase
String - text
String - text
Repeat the string
String - text Integer - times
String - text
Get the date
String - text
Get the date as milliseconds
Integer - ms
Wait n seconds
Integer - sec
Get the server name
String - name
Get the bot latency
Float - latency
Print something
Any - value
Import py file
String - name
Comment
String - text
Python source code
String - text