Share your repls and programming experiences

← Back to all posts
Python bot with a custom prefix
alanchen12

So... I made a python bot that had a changeable prefix and decided to share it here.
You can fork the repl to run it yourself, just fill in 2 fields in the env file:
DISCORD_TOKEN - your bot token
DB_TOKEN - your database token that you can get from https://s1.kognise.dev/token

This bot supports the ability to add multiple prefix's. The only command that it has is a help and a prefix command.
The default prefix is defined at the top of the code with the variable "defaultPrefix"
To use the prefix command, do:
m!prefix
You can add a prefix with
m!prefix add [prefix]
and remove one with
m!prefix remove [prefix].

You could improve this code with less if checks by using @prefix.command(), but I didn't use it

Thanks for stopping by :)

Voters
programmeruser
interception
alanchen12
Comments
hotnewtop
programmeruser

You should use replitdb instead of easypydb

alanchen12

why tho? they both have the same concept and easypypdb has unlimited keys @programmeruser

programmeruser

@alanchen12 replitdb is builtin

alanchen12

This one's too old and im not bothering to update the code, plus there are probably better ways to manage this @programmeruser