Пример #1
0
        /// <summary>
        /// Constructor for the data parser.
        /// </summary>
        /// <param name="interaction">Interaction to be parsed</param>
        public InteractionDataParsed(DiscordInteraction interaction)
        {
            Interaction = interaction;
            Data        = interaction.Data;
            //Check if MessageComponent and parse data accordingly
            if (Data.ComponentType.HasValue)
            {
                TriggeredComponentId = Data.CustomId;
                if (Data.ComponentType == MessageComponentType.SelectMenu)
                {
                    SelectMenuValues = Data.Values;
                }
                return;
            }
            Type    = Data.Type;
            Command = Data.Name;
            //If ApplicationCommand is Message or User it can't have arguments
            if (Type == ApplicationCommandType.Message || Type == ApplicationCommandType.User)
            {
                return;
            }

            UserOxideLocale  = LocaleConverter.GetOxideLocale(interaction.Locale);
            GuildOxideLocale = LocaleConverter.GetOxideLocale(interaction.GuildLocale);

            //Parse the arguments for the application command
            ParseCommand(Data.Options);
        }
Пример #2
0
 internal InteractionDataArgs(DiscordInteraction interaction, List <InteractionDataOption> options)
 {
     _interaction = interaction;
     for (int index = 0; index < options.Count; index++)
     {
         InteractionDataOption option = options[index];
         _args[option.Name] = option;
     }
 }