My bot stopping for 15 seconds everytime i run it


I’m having A lot of problems with this
I can’t run my bot which cause’s a lot of problems
I have no idea how to fix this
I’m not sure if its that cause my bot has 100+ commands or what.
1 Like

Hey, it looks like your app is taking up too much memory. You can get more by upgrading to boosted apps:

2 Likes

Or you can take a look at advanced solutions like caching 20 commands with a LRU Cache and loading a command from disk when it’s not in the cache.

So do i just add the package and its done?

Unfortunately you’ll have to figure out this yourself, I can give you the basic outline of what you want to do. You may need to change this based on how you’re loading your 100+ commands.

on message:
  find which command is being called
  check if command is in cache
  if command in in cache
     get it and execute it
  else
     load the command in and execute it

The lru cache should automatically drop unused commands but I don’t think modules actually get unloaded unfortunately

You have to be careful not to have spaghetti code.