#error running basic cog code for python discord bot

54 messages · Page 1 of 1 (latest)

molten solstice
#

Ill send the code below.

nocturne tartanBOT
#

@molten solstice, you just advanced to level 1 !

lime sapphire
#

ok

molten solstice
dense scaffold
#

You included your discord token @molten solstice

#

You should reset it

molten solstice
#

yeah i changed it mate

dense scaffold
#

As to the error... sending it might help

molten solstice
#

i sent to late i was gonna ping adam and see if hed delete but dev portal error

#

i am

#

@dense scaffold my bad im using mobile. and the websites not mobile friendly

dense scaffold
molten solstice
#

my bad

#

main.py is a sepate bot i dont even want to fuss with.

dense scaffold
#

ah I see the problem, you never actually call your main function in your bot.py

#

You define it - async def main():

#

but you never call it

molten solstice
#

how would i do that when the function is import the seperate file?

nocturne tartanBOT
#

@molten solstice, you just advanced to level 2 !

molten solstice
#

my original code

dense scaffold
#

Just add main() to the end of your bot.py

molten solstice
#

like this aye?

#

imma change the token brb

dense scaffold
#

Hmm it seems you don't really understand what the code you're writing is doing

molten solstice
#

its just supposed to send the ping

#

im just tryna learn how cogs work

#

cause my codes aren't organized and they are ugly

#

but all the explanations online and on github are poorly wrote

dense scaffold
#

What you sent just there, is you calling main() inside of main().

You need the call to it to not be indented at all

#

What you did was basically saying to Python that When I tell you to "main()", what you need to do is log into the bot, then run main() again

#

What you should say to python is When I tell you to "main()", you need to log into the bot.

Then, after that, you tell it main()

molten solstice
#

how would i format this? im just having a bit of trouble understanding how im supposed to format that

dense scaffold
#

Move the line main()all the way to the left

molten solstice
#

i have no issues with regular code, cogs hurt my head

dense scaffold
#

this is kinda basic python 😄

#

It's making a function, and calling that function

molten solstice
#

i didnt wanna ask

#

cus its simple af

#

like part 4 in the tutorial.

#

lmao.

#

makes me not wanna learn but i just learned alot about writing custom commands for yagpdb but i want to make a discord game

#

so the very last line

#

after bot token i move to the far left hand side, it should be on the border?

#

@dense scaffold maybe i misunderstood what u explained saying

dense scaffold
#

that paste is empty

molten solstice
#

idk why

#

ill be back later

#

i need my pc