コード例 #1
0
        // TODO: if settings are the same, don't update!

        public void UpdateConnection(
            string channelName,
            IPointsManager pointsManager,
            BasicBotConfiguration basicConfig)
        {
            lock (chatBots)
            {
                ChatBotConnection bot;
                if (chatBots.TryGetValue(channelName, out bot))
                {
                    bot.ConfigurePointsManager(basicConfig, pointsManager);
                }
            }
        }
コード例 #2
0
        public void ConfigurePointsManager(BasicBotConfiguration basicBotConfigurationCommand, IPointsManager newSettings)
        {
            lock (this.commands)
            {
                this.channelDetails.pointsManager = newSettings;

                this.commands.RemoveAll(x => x.commandType == Constants.CommandType.GetPoints ||
                                        x.commandType == Constants.CommandType.Help);

                this.commands.Add(new Command(Constants.CommandType.GetPoints, (message, cmd) =>
                {
                    var points    = this.channelDetails.pointsManager.GetCurrentPlayerPoints(message.Username);
                    var curString = (points == 1 ? this.channelDetails.pointsManager.CurrencySingular : this.channelDetails.pointsManager.CurrencyPlural);
                    this.sendMessage($"{message.Username} has {points} {curString}");
                },
                                              Constants.AccessLevel.Public,
                                              false,
                                              false,
                                              basicBotConfigurationCommand.queryPointsCommand,
                                              false,
                                              null,
                                              30
                                              ));

                this.commands.Add(new Command(Constants.CommandType.Help, (message, cmd) =>
                {
                    this.sendMessage(this._helpString);
                },
                                              Constants.AccessLevel.Public,
                                              false,
                                              false,
                                              basicBotConfigurationCommand.helpCommand,
                                              false,
                                              20,
                                              null
                                              ));

                updateHelpString();
            }
        }