title: (Discord bot 1.0 c#) How to make a new class and add cmds?
body: <p>Hello there Stackoverflow! (first time posting here so plz be nice :P)</p>
  
  <p>So, I've decided to make a discord bot 1.0 in c# (i'm learning c# atm) and I have gotten in to a problem and i'm not sure how to fix it..</p>
  
  <p>So, to describe what i'm trying to do is following.</p>
  
  <p>I'm trying to make it so i can have different classes for x commands such as .say etc instead of having em all in the "commands" one below so its a bit easier to work with.</p>
  
  <p>I got these working three scripts but cant get the fourth to work</p>
  
  <p>//Startup</p>
  
  <pre><code>using System;
  using System.Threading.Tasks;
  using Discord;
  using Discord.WebSocket;
  using Discord.Commands;
  
  namespace MyBot
  {
  public class Program
  {
      // Convert our sync main to an async main.
      public static void Main(string[] args) =&gt;
          new Program().Start().GetAwaiter().GetResult();
  
      private DiscordSocketClient client;
      private CommandHandler handler;
  
      public async Task Start()
      {
          // Define the DiscordSocketClient
          client = new DiscordSocketClient();
  
          var token = "Censored";
  
          // Login and connect to Discord.
          await client.LoginAsync(TokenType.Bot, token);
          await client.StartAsync();
  
          var map = new DependencyMap();
          map.Add(client);
  
          handler = new CommandHandler();
          await handler.Install(map);
  
          // Block this program until it is closed.
          await Task.Delay(-1);
      }
  
      private Task Log(LogMessage msg)
      {
          Console.WriteLine(msg.ToString());
          return Task.CompletedTask;
      }
  }
  }
  </code></pre>
  
  
  
  <p>//My command handler</p>
  
  <pre><code>using System.Threading.Tasks;
  using System.Reflection;
  using Discord.Commands;
  using Discord.WebSocket;
  
  namespace MyBot
  {
  public class CommandHandler
  {
      private CommandService commands;
      private DiscordSocketClient client;
      private IDependencyMap map;
  
      public async Task Install(IDependencyMap _map)
      {
          // Create Command Service, inject it into Dependency Map
          client = _map.Get&lt;DiscordSocketClient&gt;();
          commands = new CommandService();
          _map.Add(commands);
          map = _map;
  
          await commands.AddModulesAsync(Assembly.GetEntryAssembly());
  
          client.MessageReceived += HandleCommand;
      }
  
      public async Task HandleCommand(SocketMessage parameterMessage)
      {
          // Don't handle the command if it is a system message
          var message = parameterMessage as SocketUserMessage;
          if (message == null) return;
  
          // Mark where the prefix ends and the command begins
          int argPos = 0;
          // Determine if the message has a valid prefix, adjust argPos 
          if (!(message.HasMentionPrefix(client.CurrentUser, ref argPos) || message.HasCharPrefix('!', ref argPos))) return;
  
          // Create a Command Context
          var context = new CommandContext(client, message);
          // Execute the Command, store the result
          var result = await commands.ExecuteAsync(context, argPos, map);
  
          // If the command failed, notify the user
          if (!result.IsSuccess)
              await message.Channel.SendMessageAsync($"**Error:** {result.ErrorReason}");
      }
  }
  }
  </code></pre>
  
  
  
  <p>//Commands</p>
  
  <pre><code>using System;
  using System.Linq;
  using System.Threading.Tasks;
  using Discord;
  using Discord.Commands;
  using Discord.WebSocket;
  using System.Runtime.InteropServices;
  using System.Diagnostics;
  
  namespace MyBot.Modules.Public
  {
  public class PublicModule : ModuleBase
  {
      [Command("invite")]
      [Summary("Returns the OAuth2 Invite URL of the bot")]
      public async Task Invite()
      {
          var application = await Context.Client.GetApplicationInfoAsync();
          await ReplyAsync(
              $"A user with `MANAGE_SERVER` can invite me to your server here: &lt;https://discordapp.com/oauth2/authorize?client_id={application.Id}&amp;scope=bot&gt;");
      }
  
      [Command("leave")]
      [Summary("Instructs the bot to leave this Guild.")]
      [RequireUserPermission(GuildPermission.ManageGuild)]
      public async Task Leave()
      {
          if (Context.Guild == null) { await ReplyAsync("This command can only be ran in a server."); return; }
          await ReplyAsync("Leaving~");
          await Context.Guild.LeaveAsync();
      }
  }
  }
  </code></pre>
  
  
  
  <p>//This is the one i want to work but i only get "Unknown command" as error?</p>
  
  <pre><code>using Discord.Commands;
  using System;
  using System.Collections.Generic;
  using System.Text;
  using System.Threading.Tasks;
  
  namespace MyBot.Modules.Public
  {
  class test : ModuleBase
  {
      [Command("say")]
      [Alias("echo")]
      [Summary("Echos the provided input")]
      public async Task Say([Remainder] string input)
      {
          await ReplyAsync(input);
      }
  }
  }
  </code></pre>
  
  <p>If you know what i do wrong please tell me or reefer me to some info about the problem and i can try fix it :)
  Thanks in advance!
  PS, im sorry if there is a dupe of this question but i don't know what to search for to find it </p>
  
  <p>EDIT
  I've been told to "Pit the metohds (cmds) in the class" but how would i go around todo that?</p>