Комментарии:
Hey guys! Glad to see everyone loved the series. For those of you who want more support or need help with other bot related topics not covered in this series, I have an invite link to my discord server in the description. There are lots of people there who are willing to help you and I myself am still active as I periodically pop in to chat! Hope to see you there :)
ОтветитьThanks, for this. Question, how do you refer to a servers (guilds) prefix in another command like a help command. for example when you run the help command it does: ctx.send(f"Your prefix is {prefix}")?
ОтветитьI still don't understand, what is hikari? I just want to code and not have to download so much stuff.
ОтветитьCan anyone help me pls
So im making a discord bot and i add the custom prefix but i have some trouble to add it to modules i mean i have a command when you mention the bot the bot will send the prefix and i want to send the custom prefix does anyone help with this because i have tried and i cant figure it out and if its simple pls tell me
Now the Russian-speaking discord servers is a bastard habitat.discord server does not play any role.only from the occupancy of the bastard himself.
Ответитьhey can u show how to make a bot leave a server with a command
ОтветитьMake sure to add a fallback in get_prefix in case for whatever reason the server isn't in the prefixes.json file, you can just try except the whole thing, and in the except block, just return the default prefix (in this case the "."), so like this
def get_prefix(client, message):
if not message.guild: # DMs go by user IDs rather than a "DM ID" of some sort
return "."
try:
with open("./prefixes.json", "r") as f:
prefixes = json.load(f)
return prefixes[str(message.guild.id)]
except Exception: # Somethings gone wrong
return "."
thx for given me a good bot and making me learn how to make my own
ОтветитьThis absolutely works. Thanks for the video. Very simple and readable code. Thanks a lot man! Beautiful video!!
Ответитьyou are moving along wayyy to quickly
Ответитьthis man is a legend
ОтветитьExellent video thanks !
ОтветитьWHY ARE U SUDDDENLY JOINING THE DARK SIDE WITH JSON LMAOAOAAOAOOAA
Ответитьdef get_prefix(bot, message):
with open(prefixes.json', 'r') as f:
prefixes = json.load(f)
return prefixes[str(message.guild.id)]
It worked YAY, well I shouldn't be surprised all of Lucas's tutorials work
Ответитьhow to pull prefix on status?
Ответитьhe's recording at 12:28am OP
ОтветитьThank you, you make my bot cooler right now. I really thank you to you. Again, really-really thank you
ОтветитьWhat color theme are you using?
Ответитьwith open("prefixes.json", "w") as f:
json.dump(prefixes,f , indent-4)
i love this i love uu bc you helped me to start a discord bot
Ответитьi tried several times and the result is still the same
FileNotFoundError: [Errno 2] No such file or directory: 'prefixes.json'
i've tried using absolute path but it doesnt work for me, any solution?
Thanks Lucas!
Ответитьi cant get the bot to write in the .json file
Ответитьhey, can anyone tell me how to keep a bot online 24/7 ?
Ответитьhow to make the server prefixes appear in front of the command names in the "help" command?
ОтветитьCan you make a video about join/leave 2020
Ответитьhey @Lucas, I had some questions, and I know that this is a bit late, as you said that you finished your series, but can you please make some tutorials for adding a reaction-role system, music, and an economic system, in the rewrite version, please! I know that music is in your old tutorial, but I've made like 400 lines of code, all in the rewrite version, so can you please make tutorials for those? Btw, epic series, really cool, and I wish I had found your channel earlier! You just gained a sub!
Ответитьu got +1 sub. Nice tutorials!
ОтветитьWhat About Making a Verify Command that You Only Use ".verify" and the Bot Will Add a Verified Role to Whoever Sent the Command
ОтветитьLoved The Series💖
ОтветитьDoes anyone know why I get this error?
NameError: name 'prefixes' is not defined
I practically copied the entire code from the video but no matter what I do 'prefixes' is still not defined apparently.
Guys, I would include this line: @commands.has_permissions(administrator=True) right after the @client.commands (aka on the next line, right before the async) to make sure only people with the admin permission can change the bots prefix. Nothing much but it goes a long way trust me.Hope this helped :)
ОтветитьI have problem on return prefixes[str(guild.id)] = "-" (Invalid Syntax =)
Ответитьprefixes.pop(str(guild.id)) = '.'
^
SyntaxError: cannot assign to function call
anyone know how to fix this?
it gives me an error that I am missing two arguements client and message when I call the get_prefix() function in commands.Bot(command_prefix=get_prefix()) line
Ответитьi still can't believe that i finished this awsome series in two days, Thank you, but we want more...
Ответитьplease can you make a video on music bot
the old one doesn't work!!!
Ok, firstly thanks for the help! My bot works perfectly fine!
Anyways, how can I delete the command usage after I have done the command?
Like, if type .hello the bot responds with Hi, but the ".hello" coammand is still there! What can I do to fix it?
image banning someone cause they rejoined a server, what a neek
Ответитьworst moderator in town
ОтветитьJaxtar is some nerd
ОтветитьCan you show how to make a music bot?
ОтветитьDon't know if you're planning on making a new video but this is a great video idea I think:
Custom Help command!
Can this work if your using discord on a browser cuz I haven’t downloaded it
ОтветитьIt's important to note that if you do this, your bot will not work anymore in DM's because it won't have a prefix for direct messages/private messages (by default, all bots work in PM).
Pretty simple to fix though, just add the 'if not message.guild' bit to get_prefix (replace "?" with whatever you want your default prefix to be). Make sure to add 'message' to the arguments.
def get_prefix(client, message):
with open('prefixes.json', 'r') as f:
prefixes = json.load(f)
if not message.guild: # if in dms
return commands.when_mentioned_or("?")(client, message)