Ejemplo n.º 1
0
 internal async ValueTask Changed(IBonusGuild bonusGuild, string moduleName, string key, object value)
 {
     if (moduleName.Equals(typeof(CommonSettings).GetModuleName(), StringComparison.CurrentCultureIgnoreCase))
     {
         await CommonSettingChanged(bonusGuild, key, value);
     }
 }
Ejemplo n.º 2
0
        private async Task <EmoteData> GetEmoteData(IBonusGuild bonusGuild, IMessage message, string key)
        {
            var emote = await bonusGuild.Settings.Get <Emote>(GetType().Assembly, key);

            var reactors = await Helpers.GetReactedUserNames(message, emote, bonusGuild.DiscordGuild, _discordClientHandler);

            return(new(emote, reactors));
        }
Ejemplo n.º 3
0
 private async ValueTask CommonSettingChanged(IBonusGuild bonusGuild, string key, object value)
 {
     if (key.Equals(CommonSettings.BotName, StringComparison.CurrentCultureIgnoreCase))
     {
         await bonusGuild.DiscordGuild.CurrentUser.ModifyAsync(prop => prop.Nickname = value.ToString());
     }
     else if (key.Equals(CommonSettings.Locale, StringComparison.CurrentCultureIgnoreCase))
     {
         bonusGuild.Settings.CultureInfo       = (CultureInfo)value;
         Thread.CurrentThread.CurrentUICulture = bonusGuild.Settings.CultureInfo;
     }
 }
Ejemplo n.º 4
0
        public static async ValueTask <int?> GetVolume(IBonusGuild bonusGuild)
        {
            var player = LavaSocketClient.Instance.GetPlayer(bonusGuild.DiscordGuild.Id);

            if (player is not null)
            {
                return(player.CurrentVolume);
            }

            int?volume = await bonusGuild.Settings.Get <int>(typeof(Settings).Assembly, Settings.Volume);

            return(volume);
        }
Ejemplo n.º 5
0
        public static bool DoesSettingExists(IBonusGuild bonusGuild, string key, string moduleName)
        {
            var assembly = bonusGuild.Modules.GetActivatedModuleAssembly(moduleName);

            if (assembly is null)
            {
                return(false);
            }

            var settingsKeys = GetSettingKeys(assembly);

            return(settingsKeys.Any(k => k.Equals(key, StringComparison.CurrentCultureIgnoreCase)));
        }