Skip to content
← Back to Community
Banlist
Profile icon
Coolboy62ksi

Hay i wanted to find out if theres any code out there i can use to make abusive discord moderators so they cant use any of my bot commands so like a blacklist really but im calling it banlist if there is a response would be brilliant

Answered by VulcanWM [earned 5 cycles]
View Answer
Voters
Profile icon
Coolboy62ksi
Comments
hotnewtop
Profile icon
VulcanWM

do

#importing the replit module so you can access the replitdb where you save the people who have been banned from replit import db #adding someone to the banlist def addbanlist(id): db[str(id)] = ['Banned'] #checking if a user is in the banlist, will return True if they are, will return False if they're not def checkifbanned(id): if str(id) in db.keys(): return True else: return False
Profile icon
Coolboy62ksi

@VulcanWM thank you for the code will this be able to go in my main.py or will it need a new file made for it

Profile icon
VulcanWM

np! mark the comment as the answer please @Coolboy62ksi

Profile icon
Coolboy62ksi

@VulcanWM please answer my question first dose it go in my main.py or anther file?

Profile icon
Coolboy62ksi

How do i even add people to the banlist @VulcanWM

Profile icon
VulcanWM

If u put it in functions.py you can do
from functions import *
then you can do the functions in main.py
if u write the functions in main.py then just do the functions @Coolboy62ksi

Profile icon
VulcanWM

using the function
addbanlist(discorduserid)
@Coolboy62ksi

Profile icon
Coolboy62ksi

Im still a beginner i dont get what you mean @VulcanWM

Profile icon
Coolboy62ksi

And i only have a main.py @VulcanWM

Profile icon
VulcanWM

Just whenever you want to add someone to the banlist, do the code below
db[‘discorduserid’] = ‘Banned’
insuring you have done from replit import db before @Coolboy62ksi

Profile icon
Coolboy62ksi

I dont get what your saying i need help so i could invite you into my bot to do the code but it wont be the actual bot the code is in a test bot ready to be put into my [email protected]
https://replit.com/join/tawsmiks-coolboy62ksi

Profile icon
VulcanWM
Profile icon
VulcanWM

I added one change to the code
Check it out @Coolboy62ksi

Profile icon
Coolboy62ksi

Ok thanks @VulcanWM

Profile icon
VulcanWM
Profile icon
Coolboy62ksi

Sorry to bother again but how do i get there [email protected]

Profile icon
Coolboy62ksi

And dose it stop people from using the bots [email protected]

Profile icon
VulcanWM

ctx.author.id if ur using ctx in the discord function @Coolboy62ksi

Profile icon
VulcanWM

if u add the code yeah @Coolboy62ksi

Profile icon
Coolboy62ksi

Im no coder for the banlist lol is there chance you can give the code the ability to stop people using the commands this is for abusing admins you see to stop them abusing @VulcanWM

Profile icon
VulcanWM

Are u using ctx? @Coolboy62ksi

Profile icon
Coolboy62ksi

No and that’s because i have a help command that will list it and i want just me to have access to it @VulcanWM

Profile icon
Coolboy62ksi

So when someone abused my bot i can ban them even if its adding someone inside my bots code and not using a command in discord if it stops them using the commands then that will be fine @VulcanWM

Profile icon
VulcanWM

Are u doing ur command like
@client
.command()
async def command(ctx):
?

Profile icon
Coolboy62ksi

No i dont want it to be a command as i said anyone will be able to use it i want to use the banlist from my bot code so no one can use it it is going to be used for people that abuse so i dont want anyone to use it just me as the owner @VulcanWM

Profile icon
VulcanWM

Yeah I know but do u use it in commands? @Coolboy62ksi

Profile icon
Coolboy62ksi

No it has not get ctx on it
@VulcanWM

Profile icon
VulcanWM

then how does your commands look? @Coolboy62ksi

Profile icon
Coolboy62ksi

All other commands like mod and other commands are ctx commands and embed commands the help command automatically adds the new commands thats why i want to this banlist to only allow me to use it to stop others using the bot commands this banlist i want to use it to stop abusers so inside the repl so i want to ban a user using my repl and not a command on discord if you need access to do the code to help my bot let me know @VulcanWM

Profile icon
VulcanWM

yeah if i could see the bot code that would be nice @Coolboy62ksi

Profile icon
VulcanWM

Yeah trust me I won’t do anything with the code except make the banlist @Coolboy62ksi

Profile icon
VulcanWM

Added it to most commands which needed it
btw there were so many errors in ur code
and make sure to hide the token and delete the invite link so nobody else can join @Coolboy62ksi

Profile icon
Coolboy62ksi

Why is the addbanlist got a # at the start making it go blue @VulcanWM

Profile icon
VulcanWM

oh yeah i did that because if u run it many times it might show an error @Coolboy62ksi

Profile icon
Coolboy62ksi

@VulcanWM to be honest i cant work out this problem but it gives line errors to lines that don’t exist yet

Profile icon
Coolboy62ksi

Do you have discord by any chance as its easy because my emails are getting spammed @VulcanWM

Profile icon
VulcanWM

wdym can u screenshot the errors and send them here @Coolboy62ksi

Profile icon
VulcanWM

nah my account got disabled @Coolboy62ksi

Profile icon
Coolboy62ksi

By you or discord @VulcanWM

Profile icon
VulcanWM
Profile icon
Coolboy62ksi

@VulcanWM was there a reason why if you dont mind me Asking

Profile icon
[deleted]

@VulcanWM do you have a blacklist and whitelist code because I have about but I need it so some people cannot use the commands and others can

Profile icon
VulcanWM

Oh so u want it so that only some people can access a command? @DaHoodseller011

Profile icon
[deleted]

@VulcanWM no I want it so that if I blacklist someone it will not let them use the command but the command your helping him with I’m not using that language I’m using node.js

Profile icon
[deleted]

@VulcanWM yeah just like that

Profile icon
VulcanWM

oh i dont know node.js sorry @DaHoodseller011

Profile icon
[deleted]

@VulcanWM oof it’s alright

Profile icon
Coolboy62ksi

@DaHoodseller011 then do what I did put up a post for Node.js

Profile icon
Coolboy62ksi

I would help @DaHoodseller011 but idk much I’m hoping to learn programming and stuff later on in life

Profile icon
[deleted]

@Coolboy62ksi I tried the code but it doesn’t work cause my bots code is a little difficult to put in

Profile icon
FishballNooodle

Hi, you can check out my Updated 2021 Discord Tutorial
https://replit.com/talk/learn/Links-to-all-My-Tutorials-And-a-2021-Update/138388

Profile icon
Coolboy62ksi

@FishballNooodle i do not need this link thanks tho but its not got what im looking for

Profile icon
FishballNooodle