#π need help with a bot cog
37 messages Β· Page 1 of 1 (latest)
@coarse elbow
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
?
sorry give me one moment im seeing how this code thing works
!paste
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
u still havent asked a question yk
ok how can i fix the code? its saying that i need and await function for the bot.load_extention but when i await it it doesnt load
loop = asyncio.get_event_loop()
await loop.run_in_executor(None, load_cogs)
you dont need this
you can just await the function inside the on_ready
although ppl dont normally do that..
you could make a separate main function and load cogs and stuff in it
and dont sync your commands in on_ready
it can cause ratelimits
async def main():
intents = discord.Intents.all()
bot = commands.Bot(command_prefix='!O' , intents = intents)
await load_cogs()
bot.run()
asyncio.run(main())
smt like this
and remove all those stuff from the on_ready
itll take a while to get used to the api
and if youre new to python in general id reccommend you to first learn some basic to intermediate stuff (basic oop) atleast
I took a course but this bot stuff is confusing
yeah discord api wrappers arent beginner friendly at all
they use async programming, oop, decorators, meta classes and so many other not so easy stuff
Well it's better to try hard and learn rather than giving upπ
most people reccommend others to know atleast how oop works before diving into the deep hole of bot development but if youre deterministic enough as a beginner and still wanna do bot dev then go ahead
well just that youll find it hard to get help
so enjoy if you can
I will
unironically thats kinda how i learnt python, through making bots as a beginner
took a few years to get it all down
but was worth it
i guess
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.