예제 #1
0
        private Task Discord_GuildCreated(DSharpPlus.EventArgs.GuildCreateEventArgs e)
        {
            discord.DebugLogger.LogMessage(LogLevel.Info, "DGAssistant", "Joined new server, creating default config", DateTime.Now);
            ServerSetting defset = new ServerSetting {
                AnnounceChannelId = e.Guild.GetDefaultChannel().Id
            };

            SettingsManager.Cfg.ServerSettings.Add(e.Guild.Id, defset);
            return(Task.CompletedTask);
        }
예제 #2
0
 public static ServerSetting GetGuildSettings(DiscordGuild guild)
 {
     if (Cfg.ServerSettings.ContainsKey(guild.Id))
     {
         return(Cfg.ServerSettings[guild.Id]);
     }
     else
     {
         ServerSetting defset = new ServerSetting
         {
             AnnounceChannelId = guild.GetDefaultChannel().Id,
             FMasterChannelId  = guild.GetDefaultChannel().Id
         };
         Cfg.ServerSettings.Add(guild.Id, defset);
         SaveSettings();
         return(Cfg.ServerSettings[guild.Id]);
     }
 }