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.

registerint.cs 814 B

123456789101112131415161718192021
  1. private async Task ReadyAsync()
  2. {
  3. // pull your commands from some array, everyone has a different approach for this.
  4. var commands = _builders.ToArray();
  5. // write your list of commands globally in one go.
  6. await _client.Rest.BulkOverwriteGlobalCommands(commands);
  7. // write your array of commands to one guild in one go.
  8. // You can do a foreach (... in _client.Guilds) approach to write to all guilds.
  9. await _client.Rest.BulkOverwriteGuildCommands(commands, /* some guild ID */);
  10. foreach (var c in commands)
  11. {
  12. // Create a global command, repeating usage for multiple commands.
  13. await _client.Rest.CreateGlobalCommand(c);
  14. // Create a guild command, repeating usage for multiple commands.
  15. await _client.Rest.CreateGuildCommand(c, guildId);
  16. }
  17. }