コード例 #1
0
        internal void HandleConsoleCommand(string line)
        {
            ServerSettings consoleServerSettings = serverSettingsHandler.GetOrCreateServerSettings(Constants.ConsoleId);
            UserSettings   consoleUserSettings   = userSettingsHandler.GetOrCreateUserSettings(Constants.ConsoleId);

            HandleCommandReceived(new SenderSettings(consoleServerSettings, consoleUserSettings), new ConsoleMessageDetail(line, SlateBotProgram.ConsoleIsPrivate));
        }
コード例 #2
0
ファイル: PleaseWaitHandler.cs プロジェクト: kjhf/SlateBot
 internal void DeleteStack()
 {
     foreach (var m in pleaseWaitMessageStack)
     {
         IGuild s = m.Channel.GetGuild();
         if (s != null)
         {
             var serverSettings = serverSettingsHandler.GetOrCreateServerSettings(s.Id);
             m.EditAsync(languageHandler.GetPhrase(serverSettings.Language, "Error_Oops")).ConfigureAwait(false);
         }
     }
 }
コード例 #3
0
        public override IList <Response> Execute(SenderSettings senderDetail, IMessageDetail args)
        {
            ServerSettings       serverSettings = senderDetail.ServerSettings;
            CommandMessageHelper command        = new CommandMessageHelper(serverSettings.CommandSymbol, args.Message);

            string[] commandParams = command.CommandParams;

            if (Constants.IsBotOwner(args.UserId))
            {
                var    servers            = (client.Guilds).ToArray();
                string serverOutputString = string.Join("\n ",
                                                        servers.Select((server) =>
                {
                    var ss    = serverSettingsHandler.GetOrCreateServerSettings(server.Id);
                    var owner = server.Owner;
                    return($"`{server.Name}` ({ss.Language}): `{owner?.Username}`");
                }));

                return(Response.CreateArrayFromString(servers.Length + " servers: \n" + serverOutputString));
            }

            return(Response.CreateArrayFromString($"{Emojis.CrossSymbol} {languageHandler.GetPhrase(serverSettings.Language, "Error_BotOwnerOnly")}."));
        }