Musicbot: [Feature request] Command Aliases

Created on 29 Jan 2018  路  6Comments  路  Source: Just-Some-Bots/MusicBot

Sorry for submitting another request so soon, but I suddenly had an idea...
Create command aliases, and/or an aliases.yml/aliases config file option to manage them.
Examples:
!p = !play
!bl = !blacklist
!stop = !pause
!q = !queue
!next = !skip
etc...
I think this is a good idea to improve the usability of this bot :D

cmds request

Most helpful comment

It should be easy with discord.Bot, but the bot is using discord.Client. You have to create a new fonct with the alias name that return the real command :

async def real_command(self, player, message):
    Some codes 
async def alias_command(self, player, message):
    return await self.real_command(player, message)

An other way can be to edit the message content before calling the command, but I'm not sure if it's a good idea.

All 6 comments

It should be easy with discord.Bot, but the bot is using discord.Client. You have to create a new fonct with the alias name that return the real command :

async def real_command(self, player, message):
    Some codes 
async def alias_command(self, player, message):
    return await self.real_command(player, message)

An other way can be to edit the message content before calling the command, but I'm not sure if it's a good idea.

They specifically asked to be able to change it with config files, not editing the bot which is the whole point of the issue. Thank you for trying to help however

I would also like to request the same feature. I thought it would be better to reply to this than to create a new ticket. :P

Zenrac's comment is helpful for people with a small amount of coding knowledge, like me.
Being able to do shorthand commands like p for play is really nice.
A user-friendly way of enabling this would be great!

100% agree this would be awesome

Since I've been using the bot I always add 4 or 5 blocks at the top of the bot python file that pretty much does this, but a config file would be so good, would make it easier to update without possible merge issues and config could be easily changed for people without coding experience

I think one way to go about this is have a class made for all the commands, then a function reading from the config file could just setattr the new alias functions in.. Shouldn't be too hard.

EDIT: Just opened a pull request with this feature... Check it out => #1547

Was this page helpful?
0 / 5 - 0 ratings

Related issues

riggers-logan-1229 picture riggers-logan-1229  路  6Comments

PRiMENON picture PRiMENON  路  4Comments

zzulanas picture zzulanas  路  7Comments

ayeitzjeter picture ayeitzjeter  路  8Comments

MagnaMensa picture MagnaMensa  路  3Comments