discord-csharp / MODiX

Discord Bot handling basic moderation needs, soon implements statistics.
MIT License
114 stars 63 forks source link

multiple commands in the same message do not work #977

Closed cap5lut closed 5 months ago

cap5lut commented 1 year ago

given the discord message "some initial resources would be $helloworld and $projects" it will execute the comand for helloworld, but completely ignores the latter (this was experienced in the C# discord server, where then each "mention" would cause the bot to provide some links(

expectation: the bot would provide messages for both invocations ($helloworld and $projects)

actual behavior: the bot provides the message for $helloworld and completely ignores $projects

calledude commented 1 year ago

Culprit: TagService.cs

This would have to be changed to fetch a list and loop over to send multiple messages

            var tags = await _modixContext
                .Set<TagEntity>()
                .Where(x => x.GuildId == guildId)
                .Where(x => x.DeleteActionId == null)
                .Where(x => x.Name == name)
                .ToListAsync();

            foreach (var tag in tags)
            {
                    if (tag is null)
                        continue;

                    await messageChannel.SendMessageAsync(tag.Content, messageReference: new(invokingMessage.Id), allowedMentions: AllowedMentions.None);
            }

Edit: I don't know what I think about this however, seeing as some of the tags are humongous (see: $tryparse)

Scott-Caldwell commented 1 year ago

From my perspective, the current behavior is the desired behavior. Otherwise, it'd be very easy to spam tags and overwhelm both the conversation and the bot. Like, 2 short tags in one message is generally totally reasonable, but consider 10 or 50 or 100, especially when some of these tags are already super long. And if we're going to have a limit, then 1 is at least an obvious, easy to explain number.

I'm open to increasing the limit if there's enough demand, though.