#Bot not starting

1 messages · Page 1 of 1 (latest)

vestal lichen
#

No error message or anything.
It just hangs on interactions.Client.Start() and never triggers on_ready

high brambleBOT
#

Hey! Once your issue is solved, press the button below to close this thread!

narrow dust
#

what is your code?

vestal lichen
# narrow dust what is your code?

idk if i can share it all because theres a lot
but there's no errors or anything, i checked for duplicate commands and infinite loops

#
while True:
    clog.post("s", "Starting client...")
    try:
        bot.start()
    except Exception as e:
        clog.post("e", f"Error running client: {e}")
        time.sleep(10)
#

for some reason it never becomes 'ready' after bot.start() is run

narrow dust
#

ugh this is an ugly loop, why do you do this?

vestal lichen
#

because im doing some very hacky stuff with nodejs

#

and it is very crash-y

#
clog.post("s", "Starting client...")
bot.start()

taking it out of the loop does not change anything however

#
1343    SYS.    Backing up '/db/data.json'.
1343    ERR.    FAIL: File '/db/data.json' not found. Skipping.
1343    SYS.    Backing up '/db/images_api.json'.
1343    ERR.    FAIL: File '/db/images_api.json' not found. Skipping.
1343    SYS.    Backing up '/db/trivia.json'.
1343    ERR.    FAIL: File '/db/trivia.json' not found. Skipping.
1343    SYS.    Backing up '/db/random_blacklist.json'.
1343    ERR.    FAIL: File '/db/random_blacklist.json' not found. Skipping.
1343    SYS.    Load '/db/data.json' (id: 1488090353728)
1343    SYS.    Load '/db/images_api.json' (id: 1488089323648)
1343    SYS.    Load '/db/trivia.json' (id: 1488090213824)
1343    SYS.    Load '/db/random_blacklist.json' (id: 1488090213888)
1343    SYS.    Starting client...

these are the only logs i get before it hangs, it starts the backup of persistent data, fails (which is normal because its not configured correctly), and then runs bot.start()

#

is there some kind of debugging mode interactions comes with?

#

or verbose

high brambleBOT
#

We might ask you to enable debug logging. You can do that by doing this:

client = interactions.Client(token, logging=True)

If you want to set a specific level by yourself, you can do that with

client = interactions.Client(token, logging=the_level_you_want)

Both methods include a custom logging formatter, so only use this method if you do not already have your own logging formatter

IMPORTANT: DEBUG LOGS CONTAIN YOUR TOKEN! MAKE SURE TO CUT REMOVE IT BEFORE UPLOADING TO DISCORD!

narrow dust
#

btw youre using v4 no? Just so you know use #996211499364262039 next time

vestal lichen
#

how do I set the logging level?

#

I set logging=True but no logs

vestal lichen
#

it defaults to logging.INFO apparently which should be the max amount of info no?

high brambleBOT
#

We might ask you to enable debug logging. You can do that by doing this:

import logging

logging.basicConfig(level=logging.DEBUG)

client = interactions.Client(...)

Note: This code also enables you to set a specific logging level, if you want

narrow dust
#

can you try this instead sorry

vestal lichen
#

Heartbeat aknowledged

#

😕

#

im not really sure what im looking for

#
DEBUG:interactions:Dispatching Event: websocket_ready
DEBUG:interactions:Caching ingested rate limit data for: 
DEBUG:interactions:GET /applications/{application_id}/commands Received 200 :: [49/50 calls remaining]
DEBUG:interactions:GlobalScope is already up-to-date with 13 commands.
DEBUG:interactions:Sync of 1 scopes took 0.14255659998161718 seconds
DEBUG:interactions:Sending heartbeat every 41.25 seconds
DEBUG:interactions:Sending data to websocket: {"op": 1, "d": 3}
DEBUG:interactions:❤ Shard 0 is sending a Heartbeat
DEBUG:interactions:❤ Heartbeat acknowledged after 0.04271 seconds
DEBUG:interactions:Sending data to websocket: {"op": 1, "d": 3}
DEBUG:interactions:❤ Shard 0 is sending a Heartbeat
DEBUG:interactions:❤ Heartbeat acknowledged after 0.04074 seconds
#

status is online

#

oh i just tried to run a command i finally got an exception

narrow dust
#

It would help if we had info on your code

vestal lichen
#
  File "C:\Users\rothe\PycharmProjects\HarmonyPy\venv\Lib\site-packages\interactions\client\client.py", line 1712, in _dispatch_interaction
    if ctx.command:
       ^^^^^^^^^^^
  File "C:\Users\rothe\PycharmProjects\HarmonyPy\venv\Lib\site-packages\interactions\models\internal\context.py", line 308, in command
    return self.client._interaction_lookup[self._command_name]
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
KeyError: 'utility ping'
narrow dust
#

Show this command code

vestal lichen
#
@subcommand(name="ping", base="utility", description="Get the bot's latency")
async def ping(ctx: SlashContext):
    try:
        await ctx.send(f"Hi! My ping is uhh... {round(bot.latency * 1000)}ms")
    except OverflowError:
        await ctx.send("I dont know :(")
narrow dust
#

And utility?

vestal lichen
#

utility is not a command

narrow dust
#

I think you need to define it

vestal lichen
#

i do not

#

its not specific to this command, the same exception occurs with every command

#

ill see if i can share this code in a sec

#

i need to edit it heavily tho

dreamy imp
vestal lichen
dreamy imp
#

Oh I thought yo we're posting to a website with requests

vestal lichen
#

im trying to remember what i changed last before this happened

dreamy imp
#

Oh yeah never use rime.sleep

#

if you need it use the asyncio version

vestal lichen
#

i dont have that anymore, and that would only run if the bot completely crashed

#

im very confused rn. all 17 commands exist but somehow there is a key error with all of them?

#

and not a single event listener works

#

im gonna edit the main.py and upload it

#

actually ill just try a naked script with the bare minimum and see if that starts

#
1406    SYS.    Starting client...
1406    SYS.    Ready!  
#

ok yeah it is on my end

#

uhhuh..

#

found the line..

#
client = Client()
#

i have a class named client in main.py

class Client:
    def __init__(self):
        self.dungeon_manager = dungeon_core.DungeonManager()
        self.trivia_manager = trivia_core.TriviaManager()
        self.private_mode = False
        self.cai = None
#

im a bit confused why this makes it crash

vestal lichen
#

im gonna rewrite the bot to use extensions so i can share code in the future