#Can someone review my code please?
1 messages · Page 1 of 1 (latest)
i feel like i could handle the startup tasks better but cant think of a way
You should be testing little bits of code each time. If you haven't done that yet, you are in for one hell of a debugging session.
if it was a full featured bot i would do that, but its basically a single feature in a more advanced bot so im less afraid to just code away and test later
My suggestion is try looking to aiofiles for async File read/ write
Alsoit is a goodidea to test out bits by bits of your bot
I always do that to avoid Like too many unknown bugs Popping out
Something like Don't try to Run , if you haven't learn to Crawl As Codes are built upwards gradually
well ive been coding for over a decade and have made 5 discord bots before
granted, it was when the discord api was a lot more simple. pre custom user statuses
i looked that up when i was trying to make everything async and people told me file writing is so fast it doesnt really matter
also wait im not actually writing to a file, its staying bytes
Tbh it will matter as I dealt with it b4 by writing a whole Robotic System with Asyncio So my juniors will be able to scale on the functions
As Reading and writing files are considered Blockking it won't matter if it is a few smallchars but when it became bigger it will
oh true that was in the context of a config
Also maybe you would want to look at Regular Expressions on the valid chars part
couldnt be faster than list comprehension and join
but rly im mostly looking for critique on how im using interactions.py itself
If that's the case maybe try using Extensions to help scale up the code
thats planned
I am planning on adding a config file, logging, and splitting this up into modules later.
im like
do i really have to do this or am i missing something
channel = ctx.channel
if isinstance(channel, GuildText):
this too
async for message in history:
assert isinstance(message, Message)
if message.type == MessageType.DEFAULT:
not sure how to deal with all these extra types
and discord.py was lenient and would return an empty string if a topic was empty, for instance
I would suggest to use a db to do the stroing of your channel , message and stuff
im not storing anything
like the open() part is purely just for uploading, not saving to a file
its how ModMail works so i figured id just keep it like that, since i basically want ModMail with a few extra features
though i have been toying with the idea of writing to a temp file and saving in chunks just in case of the api messing up or something