SendMessageToUser() public method

Sends a private message to the given user.
public SendMessageToUser ( string message, DiscordSharp.DiscordMember member ) : DiscordSharp.DiscordMessage
message string The message text to send them.
member DiscordSharp.DiscordMember The member you want to send this to.
return DiscordSharp.DiscordMessage
示例#1
0
        public override void Run(DiscordClient client, DiscordPrivateMessageEventArgs e, string[] args)
        {
            // TODO Add this argument length checking to command runner
            if (args.Length > 0)
            {
                switch (args[1])
                {
                    case "UserId":
                        if (args[0] == "My")
                        {
                            args[0] = e.author.ID;
                        }

                        // Search through all members on the server for the matching username/id

                        client.SendMessageToUser($"UserId: {e.author.ID}", e.author);
                        break;

                    default:
                        client.SendMessageToUser($"Property \"{args[1]}\" not recognized", e.author);
                        break;
                }
            }
            else
            {
                // TODO Implement standard Exception system to handle error messages in the command runner
            }
        }
        public override void Run(DiscordClient client, DiscordPrivateMessageEventArgs e, string[] args)
        {
            if (args.Length > 0)
            {
                switch (args[0])
                {
                    case "Commands":
                        ReloadCommands();
                        client.SendMessageToUser("Reloaded all commands", e.author);
                        break;

                    case "Permissions":
                        Member.ReloadMembers();
                        Role.ReloadRoles();
                        client.SendMessageToUser("Reloaded permissions", e.author);
                        break;

                    default:
                        client.SendMessageToUser($"Could not reload \"{args[0]}.\" I do not recognize that.", e.author);
                        break;
                }
            }
            else
            {
                // TODO Implement standard Exception system to handle error messages in the command runner
            }
        }
        public override void Run(DiscordClient client, DiscordPrivateMessageEventArgs e, string[] args)
        {
            if (args.Length > 0)
            {
                Command command = Lookup(args[0]);
                string response;

                if (command == null)
                {
                    response = $"Command \"{args[0]}\" not recognized, make sure you spelled the command correctly.";
                }
                else
                {
                    response = command.GetUsage();
                }

                client.SendMessageToUser(response, e.author);
            }
            else
            {
                // TODO Implement standard Exception system to handle error messages in the command runner
            }
        }
 public override void Run(DiscordClient client, DiscordPrivateMessageEventArgs e, string[] args)
 {
     client.SendMessageToUser("Pong", e.author);
 }