Skip to content

versions after 4.4.6 break SlashRequirePermissions #1979

@Zbizu

Description

@Zbizu

Summary

The following code works in 4.4.6, but I get "application is not responding" when trying it with 4.4.7 and 4.4.8. Using NuGet in Visual Studio.

DiscordClient? client = Discord.GetInstance();
Discord.Commands = client.UseSlashCommands();
foreach (KeyValuePair<ulong, DiscordServerConfig> serverCfg in config.GetDiscordServers()) {
    InternalRegisterCommands(config, serverCfg.Value, Discord.Commands);
}

part of InternalRegisterCommands:

commands.RegisterCommands<TestCommands>(server.id);

test command:

public class TestCommands : ApplicationCommandModule {
    // command: /ping
    [SlashCommand("ping", "Sends a response in chat.")]
    [SlashRequirePermissions(Permissions.Administrator)]
    public async Task PingCommand(InteractionContext context) {

        // create message response
        await Response.ReplyToUser(context, "Pong! :ping_pong:");
    }
}

What version of the library are you using?

v4.4.6 (Stable)

What .NET version are you using? Make sure to use the latest patch release for your major version.

.NET 8.0

Operating System

Ubuntu 22.04.3 LTS Jammy (arch64/arm)

Reproduction Steps

  1. create test slashcommand on 4.4.6
  2. add [SlashRequirePermissions(Permissions.Administrator)] to it
  3. test if it works
  4. change version to 4.4.7 or 4.4.8
  5. test if it works again

Trace Logs

No response

Exceptions or other error messages

No response

Anything else you'd like to share

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy