Esempio n. 1
0
        /// <summary>
        /// Gets the guild settings
        /// </summary>
        /// <param name="guild"></param>
        /// <returns></returns>
        public static async Task <GuildSettings> GetGuildSettingsAsync(DiscordGuild guild)
        {
            var settings = await Dingo.Instance.Redis.FetchObjectAsync <GuildSettings>(Namespace.Combine(guild, "settings"));

            if (settings == null)
            {
                settings = new GuildSettings(guild, DefaultPrefix);
                await settings.SaveAsync();
            }

            settings.Guild = guild;
            return(settings);
        }
Esempio n. 2
0
 /// <summary>
 /// Gets the settings of the guild. It is not cached.
 /// </summary>
 /// <param name="guild"></param>
 /// <returns></returns>
 public static Task <GuildSettings> GetSettingsAsync(this DiscordGuild guild) => GuildSettings.GetGuildSettingsAsync(guild);