Beispiel #1
0
        public override void Execute(ChatMessageArgs message, string args)
        {
            if (!Service.Accounts.CheckAccess(message.User.Id, AccessFlag))
            {
                Service.Chat.SendDirectMessage(message.User, "You do not have permission to add servers to the highlights whitelist!");

                return;
            }

            var server = message.Server;

            if (server == null)
            {
                Service.Chat.SendMessage(message.Channel, message.User.Mention + " This is not a valid server!");

                return;
            }

            if (!Service.Highlights.Servers.ContainsKey(server.Id))
            {
                HighlightServer highlightServer = new HighlightServer();

                Service.Highlights.Servers.Add(server.Id, highlightServer);

                Service.Highlights.SaveChanges();

                Service.Chat.SendMessage(message.Channel, message.User.Mention + " This server has been added to the highlights whitelist!");
            }
            else
            {
                Service.Chat.SendMessage(message.Channel, message.User.Mention + " This server was already in the highlights whitelist!");
            }

            return;
        }
Beispiel #2
0
        public override void Execute(ChatMessageArgs message, string args)
        {
            if (!Service.Accounts.CheckAccess(message.User.Id, AccessFlag))
            {
                Service.Chat.SendDirectMessage(message.User, "You do not have permission to add highlight reacts to this server!");

                return;
            }

            var server = message.Server;

            if (server == null)
            {
                Service.Chat.SendMessage(message.Channel, message.User.Mention + " This is not a valid server!");

                return;
            }

            String emoji = args.Trim();

            if (emoji.Length < 1)
            {
                Service.Chat.SendMessage(message.Channel, message.User.Mention + " Usage: " + Service.Settings.ChatCommandPrefix + "addhighlightreact <EMOJI>");

                return;
            }

            if (!Service.Highlights.Servers.ContainsKey(server.Id))
            {
                Service.Chat.SendMessage(message.Channel, message.User.Mention + " This server is not setup for the highlight system!");

                return;
            }

            HighlightServer highlightServer = Service.Highlights.Servers[server.Id];

            highlightServer.ReactsAllowed.Add(emoji);

            Service.Highlights.SaveChanges();

            Service.Chat.SendMessage(message.Channel, message.User.Mention + " " + emoji + " has been added to this server's highlight reacts list!");

            return;
        }