Discord.Net icon indicating copy to clipboard operation
Discord.Net copied to clipboard

[Bug]: Modal interactions don't support Regex.

Open ImNoOSRS opened this issue 1 year ago • 4 comments

Check The Docs

  • [X] I double checked the docs and couldn't find any useful information.

Verify Issue Source

  • [X] I verified the issue was caused by Discord.Net.

Check your intents

  • [X] I double checked that I have the required intents.

Description

Modal interactions don't work with Regex (*) ComponentInteraction's do work like that but modals do not.

Version

3.13.0

Working Version

No response

Logs

N/A

Sample

public class BotInteraction<TInteraction> : InteractionModuleBase<SocketInteractionContext<TInteraction>> where TInteraction : SocketInteraction
{
    
}
public class ModalCommands : BotInteraction<SocketModal>
{
    [ModalInteraction("example-modal-*")]
    public async Task exampleModalInteraction(GiveawayInfoModal modal)
    {
       await Context.Channel.SendMessageAsync("Oh this works now? Let ImNo know.");
    }
}

Packages

Discord.Interactions

Environment

Any

ImNoOSRS avatar Feb 07 '24 10:02 ImNoOSRS

Hey Try setting TreatAsRegex to true for the ModalInteraction ex.

[ModalInteraction("example-modal-*", TreatAsRegex = true)]

by default it treats the * as a wildcard for a parameter

Misha-133 avatar Feb 11 '24 22:02 Misha-133

Hey

Try setting TreatAsRegex to true for the ModalInteraction

ex.


[ModalInteraction("example-modal-*", TreatAsRegex = true)]

by default it treats the * as a wildcard for a parameter

Great idea, did not seem to work sadly :(

ImNoOSRS avatar Feb 19 '24 21:02 ImNoOSRS