Dhravya / Spacebot

An open-source, multipurpose, configurable discord bot that does it all (that's the plan, at least)
https://dsc.gg/spacebt
MIT License
41 stars 11 forks source link

Why define Thank words on every message #16

Closed OmLanke closed 2 years ago

OmLanke commented 2 years ago

https://github.com/Dhravya/Spacebot/blob/5a3c545fe8faa0fcfa8b301c93feff95494baccf/src/cogs/backgroundtasks.py#L66

IMO, the overall background tasks are a bit too complex. You might wanna split then up into cogs or smth

Dhravya commented 2 years ago

Can you please elaborate as to what to split, etc? Thanks for the feedback though, i completely agree

OmLanke commented 2 years ago

You could move thank_words = ["thanks","thank you", "thank"] outside of the class (somewhere around line 8-9)

Or you could define it as a class attribute. Define it near line 24 outside of the __init__ (single indented) and access it using self.thank_words

OmLanke commented 2 years ago

You can also use regular expressions to check if the thank words are in the message.

Splitting the content into words and looping through all of them will put load on the machine if there are long messages. And thank you will never work as it is 2 words.

SpaceCypher commented 2 years ago

yes maybe remove 'thank you ' coz "you' will be taken as a member and when it doesnt find it ,it'll throw error

OmLanke commented 2 years ago

Yeah but you can use regex instead as it will work on multi-worded string

Dhravya commented 2 years ago

Yes thats right. @MasterBaiter123 I noticed that you forked this repository. You're working on #9 Right? maybe you could also try fixing this issue along with it?

OmLanke commented 2 years ago

Sure. i'll try

Dhravya commented 2 years ago

Thank you !!