#Slash Command Returns invalid user for some people but not others

1 messages · Page 1 of 1 (latest)

crimson lotus
#

I have a simple command like the following

[SlashCommand("pat", "Pat a member")]
        public async Task Pat(InteractionContext ctx, [Option("member", "Member to pat")] DiscordUser user)
        {
            await ctx.DeferAsync();

            DiscordMember member = ctx.Guild.Members.Values.FirstOrDefault(m => m.Id == user.Id);
            if (member != null)
            {
                var imageUrl = await NekosFunApi.GetNekosImage(NekosFunApiService.NekosFunApiTag.Pat);
                if (imageUrl != null)
                {
                    await ctx.FollowUpAsync(new DiscordFollowupMessageBuilder().AddEmbed(embed: new DiscordEmbedBuilder
                    {
                        Title = $"{ctx.Member.DisplayName} pats {member.Nickname ??  member.DisplayName}",
                        Description = null,
                        ImageUrl = imageUrl
                    }));
                }
            }
        }

When I use the slash command it works and I can tag any user in the discord the slash command works for everyone except the owner of the discord and the only person they can use in the command is the bot itself. everyone else shows up as an invalid user even after selecting them from the list of users that appears.

coral timber
#

hans tag no exception

sick wraithBOT
# coral timber hans tag no exception

Your command/autocomplete/eventhandler doesnt produce the expected result but you dont got any exception? Those are all places where the libary or a extension catches all exception and fires a event which contains those.
Exception in slashcommands -> SlashCommandsExtension#SlashCommandErrored
Exception in autocomplete -> SlashCommandsExtension#AutocompleteErrored
Exception in text commands -> CommandsNext#CommandErrored
Exception in a eventhandler (DiscordClient events) -> DiscordClient#ClientErrored