You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

Command.cs 816 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System;
  2. using System.Reflection;
  3. namespace Discord.Commands
  4. {
  5. public class Command
  6. {
  7. private Action<IMessage> _action;
  8. public string Name { get; }
  9. public string Description { get; }
  10. public string Text { get; }
  11. internal Command(CommandAttribute attribute, MethodInfo methodInfo)
  12. {
  13. var description = methodInfo.GetCustomAttribute<DescriptionAttribute>();
  14. if (description != null)
  15. Description = description.Text;
  16. Name = attribute.Name;
  17. Text = attribute.Text;
  18. }
  19. public void Invoke(IMessage msg)
  20. {
  21. _action.Invoke(msg);
  22. }
  23. private void BuildAction()
  24. {
  25. _action = null;
  26. //TODO: Implement
  27. }
  28. }
  29. }