Skip to content
Sign upLog in
← Back to Community

Python bot with a custom prefix

Profile icon
alanchen12Hacker

UPDATE - NOT MAINTAINED AND OUTDATED

This code was written around a year ago, and I haven't touched it since. It was never great code, so I decided that I would not be providing support anymore. You may modify it yourself if you know what you are doing, but I don't have the willpower to update this.

^^^

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
Profile icon
aishwaryaashok1
Profile icon
111dev111
Profile icon
programmeruser
Profile icon
interception
Profile icon
alanchen12
Comments
hotnewtop
Profile icon
bradymc222

@alanchen12
do you have discord? I would like your help with your code....

Profile icon
programmeruser

You should use replitdb instead of easypydb

Profile icon
alanchen12

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

@programmeruser

Profile icon
programmeruser

@alanchen12
replitdb is builtin

Profile icon
alanchen12

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

@programmeruser