gurkult / gurkbot

Our community bot, used for running the server.
MIT License
18 stars 16 forks source link

Load/Unload Cogs #15

Open uncomfyhalomacro opened 3 years ago

uncomfyhalomacro commented 3 years ago

Once we are done with the core, I would like us to have this feature. We will need to have a feature where we can load and unload specific commands. This way, we have more control of the bot (specifically the Supreme Gurkan and his trusted cucumbers). The command will look like .ext load <command/Cog> or .ext unload <command/Cog>. I think @Xithrius have made this kind of feature. However, I do not want him to take responsibility for this feature, I want others to take part and use this chance to learn new things. If you have any suggestions, proposals, rebuttals, and comments, feel free to do it here.

RandomDev26 commented 3 years ago

I think this is a great idea, and will most likely prove to be useful.

Xithrius commented 3 years ago

.ext load <command/Cog> or .ext unload <command/Cog>

@ReneganRonin I'm not sure what you mean by changing the load status of a command, but I can for sure unload/load/reload a cog or extension.

gustavwilliam commented 3 years ago

Maybe we could implement something to activate or deactivate individual commands later on, but for now the cogs will do. That's the most important part.

Xithrius commented 3 years ago

I'm not sure if enabling/disabling a command on the fly is actually possible without hardcoding it.

Edit: Nevermind, I think it is possible with this update method of command objects.

Edit 2: Yes, it is possible with that feature. You need a object of command type, and then you can use the .update method. To enable/disable the command the method can be called by command_to_change.update(enabled=False)

gustavwilliam commented 3 years ago

Maybe we could add some dark magic in the command processing that checks if some "is_active" item is true in a dict. That's the only way I can think of really.

Shivansh-007 commented 3 years ago

Maybe we could add some dark magic in the command processing that checks if some "is_active" item is true in a dict. That's the only way I can think of really.

Hmmm, yeah! we could put that case, like if it is not active, we could display some message and if it active it would run normally

gustavwilliam commented 3 years ago

That would be quite simple to manage in the error handler. Also, @Xithrius has managed to figure out how a disable command could work. It would be possible.

Xithrius commented 3 years ago

Edit 2: Yes, it is possible with that feature. You need a object of command type, and then you can use the .update method. To enable/disable the command the method can be called by command_to_change.update(enabled=False)

@Shivansh-007 here's what I figured out.

Shivansh-007 commented 3 years ago

Edit 2: Yes, it is possible with that feature. You need a object of command type, and then you can use the .update method. To enable/disable the command the method can be called by command_to_change.update(enabled=False)

@Shivansh-007 here's what I figured out.

Ah ok, didn't see that 😅

gustavwilliam commented 3 years ago

It's anyone interested in giving this a shot? It's very convenient — especially during development.

Xithrius commented 3 years ago

If no one takes it, I will.

uncomfyhalomacro commented 3 years ago

@Xithrius alright. dunno why no one wants to take it. i am mostly busy so i cant do that as well

gustavwilliam commented 3 years ago

Hey @Xithrius, do we have any progress on this?

If you want something to base this on, the PyDis ext commands are pretty good. I personally migrated it from Python to Sir Lancelot (SeasonalBot) a while back, and it shouldn't be a nightmare to migrate to this bot, if you want to use it as a base.

Xithrius commented 3 years ago

@gustavwilliam I'll probably use a variant of the one that I have in my own bot. The command can be seen here.

Will most likely change it once error logging and any other PRs are merged.

gustavwilliam commented 3 years ago

Ah, perfect. For the record, I've put this as a high priority issue, since it's really important during development of basically all features.

Inheritanc-e commented 3 years ago

umm do u mean commands or cog?

Shivansh-007 commented 3 years ago

Cogs

gustavwilliam commented 3 years ago

Is anyone interested in working on this issue? Xithrius doesn’t have time for it at the time being.

uncomfyhalomacro commented 3 years ago

i guess i will start working on this over the weekend. i will review the docs.

Arnav-2004 commented 3 years ago

Assign this to me please

onerandomusername commented 2 years ago

I don't think anyone is ever going to implement this.

onerandomusername commented 2 years ago

I was a bit bored.