Cxsket / Xeno-nukebot

0 stars 0 forks source link

πŸ’€πŸ’€πŸ’€ #1

Closed ghost closed 5 months ago

ghost commented 6 months ago

Very weird code... L18-24: why author set flags if he already used Intents.all() L28-32: unused variables (why do you even need http api variables if you have d.py) on_ready: author could just used pre-made text like in guide embed without unnecessary code massban: batch logic is useless, because you just ban members sequentially without actually running batches with multithreading dchan: batch logic is useless, because you just start all tasks at once at L127 (and even if L125 actually started task, it anyways would be in short period of time) gnuke.delete_channels: why only text channels? why sequentially? gnuke.create_channels: what is this weird triple range loop? variables are unused and you could just used 1000000 value. and anyways, channel limit is 500 uinfo&avatar: do almost identical(and identically useless) task, could be combined scrape: very weird and useless piece of code. I guess author planned to parse members via http api (aiohttp session created), but http api part does nothing. then autor uses guild.chunk (which will load member list if I remember correctly) and then completely ignores it and just uses guild.channels to get channel ids and names. if text length will exceed embed size limit command will just not work nuke.create_channels: again, channel limit is 500, and code will do 600 AT ONCE on_guild_channel_create: what's the point of spam-creating webhooks if they are not even used? also, 10 message send api calls will just happen at once, and when any of task throws exception (which will apparently happen when you get webhook creation ratelimit) it will just probably throwed from asyncio.gather and end while True loop and sugar on a cream on_command_error: it will just completely ignore all exceptions, and if condition is pointless, because it will return in both conditions

well, total exception ignoring explains how this code even got here...

Cxsket commented 6 months ago

@CipherDeveloper This is an old nukebot code, I will be updating this. I do realize that the batches are useless and yes, the webhooks aren't even being used. I thought they were. I forgot to put a print to see if the webhooks are being created or not in the code, but I am planning to get this code updated. also, what do you mean "very weird code"? - I'm not sure what context are trying to say in the code that's weird. Are you talking about the batches, the channel limit, the intents, etc?

ghost commented 6 months ago

I'm talking about code in general, because it's kinda weird for me. Like, 500 channel limit is something basic than almost everyone knows. And threading organization is like unspoken rules - channels must be always deleted with something like asyncio.gather (because API almost don't have limits and 500 channels can be deleted in ~5 seconds), bans can use some threading optimizations. And uncontrolled message spam usage will ratelimit your bot very soon. And not just your bot, your IP too, so you can't even use discord client if you are running bot locally. Same goes for help commands - using static texts is very weird, because it may lead to problems when you add/remove commands. Most of good projects use automatic help generation.

Btw, I don't have any mean intentions, I just wanted to point out your errors, so you can write better code next time :)

Cxsket commented 6 months ago

Well, I am going back in the basics of python and it's going to take me long to understand the specific requirements of python with a long-term goal or short-term. I should be able to do this, even if i get errors then that's part of learning.