コード例 #1
0
 public void LoadConfiguration()
 {
     toMonitor.Add(0);
     toMonitor             = BotConfiguration.GetSetting("StreamingMonitor.ToMonitor", this, toMonitor);
     announceStreamChannel = BotConfiguration.GetSetting("StreamingMonitor.ChannelID", this, announceStreamChannel);
     announceMessageHeader = BotConfiguration.GetSetting("StreamingMonitor.MessageHeader", this, announceMessageHeader);
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: Lomztein/Adminthulhu
        public void LoadConfiguration()
        {
            mainTextChannelName = BotConfiguration.GetSetting("Server.MainTextChannelName", this, "general");
            dumpTextChannelName = BotConfiguration.GetSetting("Server.DumpTextChannelName", this, "dump");
            serverName          = BotConfiguration.GetSetting("Server.Name", this, "Discord Server");
            serverID            = BotConfiguration.GetSetting <ulong> ("Server.ID", this, 0);
            cultureName         = BotConfiguration.GetSetting("Server.CultureName", this, cultureName);
            CultureInfo cultureInfo = new CultureInfo(cultureName);

            CultureInfo.DefaultThreadCurrentCulture   = cultureInfo;
            CultureInfo.DefaultThreadCurrentUICulture = cultureInfo;

            onUserJoinMessage           = BotConfiguration.GetSetting("Server.Messages.OnUserJoin", this, onUserJoinMessage);
            onUserJoinFromInviteMessage = BotConfiguration.GetSetting("Server.Messages.OnUserJoinFromInvite", this, onUserJoinFromInviteMessage);
            onUserLeaveMessage          = BotConfiguration.GetSetting("Server.Messages.OnUserLeave", this, onUserLeaveMessage);
            onUserBannedMessage         = BotConfiguration.GetSetting("Server.Messages.OnUserBanned", this, onUserBannedMessage);
            onUserUnbannedMessage       = BotConfiguration.GetSetting("Server.Messages.OnUserUnbanned", this, onUserUnbannedMessage);
            onUserChangedNameMessage    = BotConfiguration.GetSetting("Server.Messages.OnUserChangedName", this, onUserChangedNameMessage);
            onPatchedAnnounceChannel    = BotConfiguration.GetSetting("Server.Messages.OnPatchedAnnounceChannel", this, (ulong)0);

            commandTrigger       = BotConfiguration.GetSetting("Command.Trigger", this, "!");
            commandTriggerHidden = BotConfiguration.GetSetting("Command.HiddenTrigger", this, "/");

            phrases = BotConfiguration.GetSetting("Misc.ResponsePhrases", this, new Phrase [] { new Phrase("Neat!", 0, 100, "Very!", 0, ""), new Phrase("Neato", 0, 100, "", 0, "🌯") });
        }
コード例 #3
0
            public override void LoadConfiguration()
            {
                base.LoadConfiguration();

                Dictionary <string, ulong> togglables = new Dictionary <string, ulong> ();

                togglables.Add("International", 0);
                togglables.Add("NSFW", 1);

                togglables = BotConfiguration.GetSetting("UserSettings.Togglables", this, togglables);

                commandsInSet = new Command [0];
                List <Command> tCommands = new List <Command> ();

                foreach (var entry in togglables)
                {
                    CToggleRole cmd = new CToggleRole();
                    cmd.command = entry.Key.ToLower();
                    cmd.roleID  = entry.Value;

                    tCommands.Add(cmd);
                }

                AddProceduralCommands(tCommands.ToArray());
            }
コード例 #4
0
 public void LoadConfiguration()
 {
     upvote            = BotConfiguration.GetSetting("Karma.UpvoteEmojiName", this, "upvote");
     downvote          = BotConfiguration.GetSetting("Karma.DownvoteEmojiName", this, "downvote");
     upvotesToQuote    = BotConfiguration.GetSetting("Karma.UpvotesToQuote", this, upvotesToQuote);
     downvotesToDelete = BotConfiguration.GetSetting("Karma.DownvotesToDelete", this, downvotesToDelete);
 }
コード例 #5
0
        public void LoadConfiguration()
        {
            Random random = new Random();

            encryptionKey  = BotConfiguration.GetSetting("Misc.EncryptionKey", this, (byte)random.Next(1, 255));
            encryptionSeed = BotConfiguration.GetSetting("Misc.EncryptionSeed", this, random.Next(int.MinValue, int.MaxValue));
        }
コード例 #6
0
 public void LoadConfiguration()
 {
     foreach (UserSettingsCommandBase settingBase in commands)
     {
         defaultValues.Add(settingBase.key, BotConfiguration.GetSetting("UserSettings." + settingBase.key + "Default", this, settingBase.superDefaultValue));
     }
 }
コード例 #7
0
 public void LoadConfiguration()
 {
     activeThresholdDays  = BotConfiguration.GetSetting("Activity.ActiveThresholdDays", this, 7);
     presentThresholdDays = BotConfiguration.GetSetting("Activity.PresentThresholdDays", this, 14);
     activeUserRole       = BotConfiguration.GetSetting <ulong> ("Roles.ActiveID", this, 0);
     presentUserRole      = BotConfiguration.GetSetting <ulong> ("Roles.PresentID", this, 0);
     inactiveUserRole     = BotConfiguration.GetSetting <ulong> ("Roles.InactiveID", this, 0);
 }
コード例 #8
0
 public void LoadConfiguration()
 {
     defaultPermissions = new Dictionary <Type, State> ();
     for (int i = 0; i < (int)Type.Count; i++)
     {
         defaultPermissions.Add((Type)i, BotConfiguration.GetSetting("Permissions." + ((Type)i).ToString() + "Default", this, State.Inherit));
     }
 }
コード例 #9
0
ファイル: Clock.cs プロジェクト: Lomztein/Adminthulhu
 public void LoadConfiguration()
 {
     clockablesEnabled = new bool [clockables.Length];
     offsetHours       = BotConfiguration.GetSetting("Clockables.OffsetHours", this, offsetHours);
     for (int i = 0; i < clockablesEnabled.Length; i++)
     {
         clockablesEnabled [i] = BotConfiguration.GetSetting("Clockables." + clockables[i].GetType().Name + "Enabled", this, false);
     }
 }
コード例 #10
0
        public static int capraPopFlySprawlsYeekYoungin = 2; // This is your fault, Fred.

        public void LoadConfiguration()
        {
            younglingRoleID = BotConfiguration.GetSetting <ulong> ("Roles.YounglingID", this, 0);
            onKickedDM      = BotConfiguration.GetSetting("Activity.Younglings.OnKickedDM", this, "Sorry, but you've been kicked from my server due to early inactivity. If you feel this was a mistake, feel free to use this invite link: {INVITELINK}");
            onAcceptedDM    = BotConfiguration.GetSetting("Activity.Younglings.OnAcceptedDM", this, "Congratulations, you now have full membership of my server!");
            onAcceptedPublicAnnouncement = BotConfiguration.GetSetting("Activity.Younglings.OnAcceptedPublicAnnouncement", this, "Congratulations to {USERNAME} as they've today been granted permanemt membership of this server!");
            onRemindDM                    = BotConfiguration.GetSetting("Activity.Younglings.OnRemindDM", this, "Heads up! You will soon be kicked from my server in 2 days due to inactivity! To avoid this, please send a message in any channel or join a voice channel.");
            daysActiveRequired            = BotConfiguration.GetSetting("Activity.Younglings.DaysActiveRequired", this, daysActiveRequired);
            capraPopFlySprawlsYeekYoungin = BotConfiguration.GetSetting("Activity.Younglings.RemindBeforeKickDays", this, capraPopFlySprawlsYeekYoungin);
        }
コード例 #11
0
        public void LoadConfiguration()
        {
            enabled = BotConfiguration.GetSetting("Games.Enabled", this, enabled);

            gameRoles = new Dictionary <string, ulong> {
                { "GAME NAME #1", 0 },
                { "GAME NAME #2", 0 }
            };

            gameRoles = BotConfiguration.GetSetting("Games.GameRoles", this, gameRoles);
        }
コード例 #12
0
        public Task <Result> Execute(SocketUserMessage e, string expression, object input)
        {
            List <BotConfiguration.Entry> toModify = BotConfiguration.RegexSearchEntries(expression);
            IEnumerable <string>          names    = toModify.Select(x => x.name);

            Program.messageControl.SendMessage(e.Channel, names.ToArray().Singlify(), false, "```");
            int succesful = 0;

            Program.messageControl.AskQuestion(e.Channel.Id, "Confirm edit of these configuration entries?", delegate() {
                foreach (string entry in names)
                {
                    object current      = BotConfiguration.GetSetting(entry, null, default(object));
                    object possibleJSON = null;
                    try {
                        possibleJSON = JsonConvert.DeserializeObject(current.ToString());
                    } catch { }

                    object newObject = null;
                    try {
                        newObject = Convert.ChangeType(input, current.GetType());
                        BotConfiguration.SetSetting(entry, newObject, false);
                        succesful++;
                    } catch (Exception exception) {
                        Logging.Log(exception);
                    }
                }

                BotConfiguration.SaveSettings();
                Program.messageControl.SendMessage(e, $"Succesfully edited {succesful} out of {toModify.Count} entries.", false);

                List <BotConfiguration.Entry> reloaded = new List <BotConfiguration.Entry> ();
                foreach (var entry in toModify)
                {
                    if (!reloaded.Contains(entry))
                    {
                        entry.ReloadConfigurables();
                        reloaded.Add(entry);
                    }
                }
            });

            return(TaskResult(null, ""));
        }
コード例 #13
0
        public virtual void LoadConfiguration()
        {
            string [] parts = helpPrefix.Length > 1 ? helpPrefix.Substring(1).Split(' ') : new string [0];
            string    path  = "";

            foreach (string part in parts)
            {
                if (part.Length > 0)
                {
                    path += part.Substring(0, 1).ToUpper() + part.Substring(1) + ".";
                }
            }
            if (this as CommandChain.CustomCommand != null)
            {
                commandEnabled = true; // Force enable custom commands.
            }
            else
            {
                commandEnabled = BotConfiguration.GetSetting("Command." + path + command.Capitalize() + "Enabled", this, false);
            }
        }
コード例 #14
0
        public void LoadConfiguration()
        {
            votesPerPerson           = BotConfiguration.GetSetting("WeeklyEvent.VotesPerPerson", this, votesPerPerson);
            gamesPerWeek             = BotConfiguration.GetSetting("WeeklyEvent.GamesPerWeek", this, gamesPerWeek);
            announcementsChannelName = BotConfiguration.GetSetting("Server.AnnouncementsChannelName", this, "announcements");

            everyXWeek   = BotConfiguration.GetSetting("WeeklyEvent.EveryXWeek", this, everyXWeek);
            voteStartDay = BotConfiguration.GetSetting("WeeklyEvent.VoteStartDay", this, voteStartDay);
            voteEndDay   = BotConfiguration.GetSetting("WeeklyEvent.VoteEndDay", this, voteEndDay);
            eventDayName = BotConfiguration.GetSetting("WeeklyEvent.EventDayName", this, eventDayName);
            daysBetween  = BotConfiguration.GetSetting("WeeklyEvent.DaysBetweenVoteAndEvent", this, daysBetween);
            eventHour    = BotConfiguration.GetSetting("WeeklyEvent.Hour", this, eventHour);

            onEventJoinedDM            = BotConfiguration.GetSetting("WeeklyEvent.Messages.OnEventJoinedDM", this, onEventJoinedDM);
            onEventLeftDM              = BotConfiguration.GetSetting("WeeklyEvent.Messages.OnEventLeftDM", this, onEventLeftDM);
            onEventChosenByVoteMessage = BotConfiguration.GetSetting("WeeklyEvent.Messages.OnEventChosenByVoteMessage", this, onEventChosenByVoteMessage);
            onVotedEventLostDM         = BotConfiguration.GetSetting("WeeklyEvent.Messages.OnVotedEventLostDM", this, onVotedEventLostDM);
            onNewVoteStartedMessage    = BotConfiguration.GetSetting("WeeklyEvent.Messages.OnNewVoteStartedMessage", this, onNewVoteStartedMessage);
            onMaxVotesReachedDM        = BotConfiguration.GetSetting("WeeklyEvent.Messages.OnMaxVotesReachedDM", this, onMaxVotesReachedDM);
            onVotedForGameTwiceDM      = BotConfiguration.GetSetting("WeeklyEvent.Messages.OnVotedForGameTwiceDM", this, onVotedForGameTwiceDM);
            onVotedPostCount           = BotConfiguration.GetSetting("WeeklyEvent.Messages.OnVotedPostCount", this, onVotedPostCount);
        }
コード例 #15
0
        public void LoadConfiguration()
        {
            ResetData();
            extraChannelNames      = BotConfiguration.GetSetting <string []> ("Voice.ExtraChannelNames", this, new string [] { "EXTRA_CHANNEL_1;EXTRA_CHANNEL_SHORT_NAME_1", "EXTRA_CHANNEL_1;EXTRA_CHANNEL_SHORT_NAME_2" });
            loadedChannels         = BotConfiguration.GetSetting("Voice.DefaultChannels", this, new VoiceChannel [] { new VoiceChannel(0, "DEFAULT_CHANNEL_NAME_1;SHORT_NAME_1", 0), new VoiceChannel(1, "DEFAULT_CHANNEL_NAME_2;SHORT_NAME_2", 0) });
            afkChannel             = BotConfiguration.GetSetting("Voice.AFKChannel", this, new VoiceChannel(2, "AFK_CHANNEL_NAME", int.MaxValue - 1));
            autoAddChannels        = BotConfiguration.GetSetting("Voice.AutoAddChannels", this, autoAddChannels);
            autoRenameChannels     = BotConfiguration.GetSetting("Voice.AutoRenameChannels", this, autoRenameChannels);
            shortenChannelNames    = BotConfiguration.GetSetting("Voice.ShortenChannelNames", this, shortenChannelNames);
            enableVoiceChannelTags = BotConfiguration.GetSetting("Voice.ChannelTagsEnabled", this, enableVoiceChannelTags);
            younglingRoleID        = BotConfiguration.GetSetting("Roles.YounglingID", this, younglingRoleID);
            internationalRoleID    = BotConfiguration.GetSetting("Roles.InternationalID", this, internationalRoleID);
            musicBotID             = BotConfiguration.GetSetting("Misc.MusicBotID", this, musicBotID);
            postRebootChannelName  = BotConfiguration.GetSetting("Voice.PostRebootChannelName", this, postRebootChannelName);
            randomizeNameQueue     = BotConfiguration.GetSetting("Voice.RandomizeNameQueue", this, randomizeNameQueue);

            gameNameReplacements.Add("Game name 1", "Game name replacement 1");
            gameNameReplacements.Add("Game name 2", "Game name replacement 2");
            gameNameReplacements = BotConfiguration.GetSetting("Voice.GameNameReplacements", this, gameNameReplacements);

            foreach (VoiceChannelTag tag in voiceChannelTags)
            {
                tag.enabled  = BotConfiguration.GetSetting("Voice.Tags." + tag.name + ".Enabled", this, tag.enabled);
                tag.tagEmoji = BotConfiguration.GetSetting("Voice.Tags." + tag.name + ".Emoji", this, tag.tagEmoji);
            }

            foreach (VoiceChannel channel in loadedChannels)
            {
                AddDefaultChannel(channel);
            }
            addChannelsIndex = defaultChannels.Count;
            AddDefaultChannel(afkChannel);

            for (int i = 0; i < extraChannelNames.Length; i++)
            {
                nameQueue.Add(extraChannelNames [i], false);
            }
        }
コード例 #16
0
ファイル: AutoPatcher.cs プロジェクト: Lomztein/Adminthulhu
 public void LoadConfiguration()
 {
     doAutoPatch = BotConfiguration.GetSetting("Patcher.DoAutoPatch", this, doAutoPatch);
     announcePatchAvailabilityChannelID = BotConfiguration.GetSetting("Patcher.AnnouncePatchAvailabilityChannelID", this, announcePatchAvailabilityChannelID);
     askToPatchChannelID = BotConfiguration.GetSetting("Patcher.AskToPatchChannelID", this, askToPatchChannelID);
 }
コード例 #17
0
 public void LoadConfiguration()
 {
     onBirthdayAnnouncementMessage = BotConfiguration.GetSetting("Birthdays.OnBirthdayAnnouncementMessage", this, onBirthdayAnnouncementMessage);
     onBirthdayCongratulationsDM   = BotConfiguration.GetSetting("Birthdays.OnBirthdayCongratulationsDM", this, onBirthdayCongratulationsDM);
 }
コード例 #18
0
 public void LoadConfiguration()
 {
     strikeRoleID        = BotConfiguration.GetSetting <ulong> ("Roles.StrikeID", this, 0);
     strikeGivenMessage  = BotConfiguration.GetSetting("Strikes.OnGivenMessage", this, "Sorry, but you've recieved a strike due to {STRIKEREASON}. This strike will automatically be raised on {STRIKERAISEDATE}");
     strikeRaisedMessage = BotConfiguration.GetSetting("Strikes.OnRaisedMessage", this, "You've done your time, and your strike has now been risen.");
 }
コード例 #19
0
ファイル: CSetColor.cs プロジェクト: Lomztein/Adminthulhu
 public override void LoadConfiguration()
 {
     base.LoadConfiguration();
     allowed       = BotConfiguration.GetSetting("Misc.AvailableUsernameColors", this, new string [] { "RED", "BLUE" });
     autoAddOnJoin = BotConfiguration.GetSetting("Misc.AutoSetColorsOnJoin", this, autoAddOnJoin);
 }
コード例 #20
0
 public void LoadConfiguration()
 {
     percentageForEventActive = BotConfiguration.GetSetting("Events.PersentageForEventActive", this, percentageForEventActive);
 }
コード例 #21
0
ファイル: AprilFools.cs プロジェクト: Lomztein/Adminthulhu
 public void LoadConfiguration()
 {
     activeRoleID = BotConfiguration.GetSetting <ulong> ("Roles.ActiveID", this, 0);
 }
コード例 #22
0
 public override void LoadConfiguration()
 {
     base.LoadConfiguration();
     reportTextChannel = BotConfiguration.GetSetting <ulong> ("Server.ReportChannelID", this, 0);
 }