'Is there a way to overload commands in Discord.net?

I have two modules for my Discord Bot: The first one is the UserModule, where every commands are, that users can execute, and the second one is the AdminModule, where the server admins can customize and set up the bot. Now I got the command Money in my UserModule, that makes the bot tell the executor how much money he has. But there's another money command for the admins:

[Group("Money")]
    class Credits : ModuleBase
    {
        [Command("add")]
        public void AddMoney(IGuildUser user, int amount)
        {
            int money = Convert.ToInt32(DBConnector.GetInstance().GetDBData
                ($"SELECT Money FROM Users WHERE UserID = {user.Id} AND ServerID = {Context.Guild.Id}")[0]);

            //This will be read from the database in the future
            bool capped = false;

            if (capped)
            {
                int maxAmount = Convert.ToInt32(DBConnector.GetInstance().GetDBData
                ($"SELECT Money FROM Users WHERE UserID = {user.Id} AND ServerID = {Context.Guild.Id}")[0]);

                if (money + amount > maxAmount)
                {
                    amount = maxAmount - money;
                }
            }

            DBConnector.GetInstance().ExecuteCommand($"UPDATE Users SET Money=Money+{amount} WHERE UserID = {user.Id} AND ServerID = {Context.Guild.Id}");
        }
//some more commands
...

This is a submodule in the AdminModule and obviously for manually adding or removing money from users. But when I wanted to test the command with //money add @user 10, I got the error, that "The input text has too many parameters." This indicates, that the bot uses the UserCommand instead of the AdminCommand, so I wondered how I can make the bot realize

"Hey, that command has a usermention and an integer. This is also the case for the admin command. Let me execute that one"



Solution 1:[1]

If I look at this problem you have two solutions for this very problem.

1. Solution

I'd assume that your different users have different roles. Therefor your Admins got a role called Server Admin or similar. You could create a custom PreconditionAttribute see the documentation for an example. This attribute could return an Error for all roles provided. This way you could "forbid" the //money add command for admins. Then another one which would only allow the admins to execute the admin version of it.

2. Solution

This one is a bit more dirty and not recommended. You could only hold on one Add Command which would contain the logic for the normal and admin users. With an if statement you could check for their role and decide to do next.

I am pretty sure the first solution would fit better for your needs.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1