Esempio n. 1
0
        public static void SetBotChannel(GuildSettings guild, ulong channelID)
        {
            GuildSettings updatedGuild = guild;

            guild.ChannelID = channelID;

            guildData.Remove(guild);
            guildData.Add(updatedGuild);
            if (File.Exists($"Users/Guilds/{updatedGuild.GuildID}.json"))
            {
                File.Delete($"Users/Guilds/{updatedGuild.GuildID}.json");
            }
            Utilities.WriteToJsonFile <GuildSettings>($"Users/Guilds/{updatedGuild.GuildID}.json", updatedGuild);
        }
Esempio n. 2
0
        public static void UpdateSearch(ulong guildID, bool search = true)
        {
            GuildSettings s = new GuildSettings()
            {
                GuildID = guildID, ServerSearch = search
            };

            guildData.Add(s);
            if (File.Exists($"Users/Guilds/{guildID}.json"))
            {
                File.Delete($"Users/Guilds/{guildID}.json");
            }
            Utilities.WriteToJsonFile <GuildSettings>($"Users/Guilds/{guildID}.json", s);
        }
Esempio n. 3
0
        public static GuildSettings GetSettings(ulong guildID)
        {
            GuildSettings u = guildData.FirstOrDefault(x => x.GuildID == guildID);

            if (u == default(GuildSettings))
            {
                return(new GuildSettings()
                {
                    ServerSearch = true, GuildID = guildID, ChannelID = default(ulong)
                });
            }
            else
            {
                return(u);
            }
        }