public async Task <RuntimeResult> SetExpGainEnabled(IGuildUser user, bool newValue)
        {
            new ExpManager().SetXPDisabledTo(user, newValue);
            await Task.CompletedTask;

            return(CustomResult.FromSuccess());
        }
        public async Task <RuntimeResult> CreateChannelGroup(string groupName)
        {
            var configurationStep = new ConfigurationStep("What type of group is this? (🏁 checks, ❓ FAQ, 🤖 command)", Interactive, Context, ConfigurationStep.StepType.Reaction, null);
            var addAction         = new ReactionAction(new Emoji("🏁"));

            addAction.Action = async(ConfigurationStep a) =>
            {
                new ChannelManager().createChannelGroup(groupName, ChannelGroupType.CHECKS);
                await Task.CompletedTask;
            };

            var deleteCommandChannelAction = new ReactionAction(new Emoji("❓"));

            deleteCommandChannelAction.Action = async(ConfigurationStep a) =>
            {
                new ChannelManager().createChannelGroup(groupName, ChannelGroupType.FAQ);
                await Task.CompletedTask;
            };

            var deleteCommandAction = new ReactionAction(new Emoji("🤖"));

            deleteCommandAction.Action = async(ConfigurationStep a) =>
            {
                new ChannelManager().createChannelGroup(groupName, ChannelGroupType.COMMANDS);
                await Task.CompletedTask;
            };

            configurationStep.Actions.Add(addAction);
            configurationStep.Actions.Add(deleteCommandChannelAction);
            configurationStep.Actions.Add(deleteCommandAction);

            await configurationStep.SetupMessage();

            return(CustomResult.FromSuccess());
        }
Exemple #3
0
        public async Task <RuntimeResult> Announce(String message)
        {
            // THIS IS BAD PRACTICE DON'T DO THIS
            // TODO: Move this to a service or somewhere not here, so if the bot crashes we can continue automatically.
            _ = Task.Run(() =>
            {
                Thread.Sleep(5000);
                foreach (SocketGuild g in this.Client.Guilds)
                {
                    var embed = new EmbedBuilder
                    {
                        Title       = "Bot Announcement",
                        Color       = Color.Orange,
                        Description = message,
                        Footer      = new EmbedFooterBuilder
                        {
                            Text = DateTime.Now.ToShortDateString()
                        }
                    }.Build();

                    g.DefaultChannel.SendMessageAsync(embed: embed);
                    Thread.Sleep(5000);
                }
            });
            return(CustomResult.FromSuccess("Announcement will begin in 10 seconds."));
        }
Exemple #4
0
        public async Task <RuntimeResult> SteampAsync([Remainder] string user)
        {
            await Context.Message.AddReactionAsync(Global.Emotes[Global.OnePlusEmote.SUCCESS].GetAsEmote());

            var request = (HttpWebRequest)WebRequest.Create(string.Format(BadgeUrl, user));

            using (var response = await request.GetResponseAsync())
                using (var stream = response.GetResponseStream())
                {
                    if (stream == null)
                    {
                        return(CustomResult.FromError("Could not establish a connection to the Steam API"));
                    }

                    using (var fs = File.Open("output.png", FileMode.Create, FileAccess.Write, FileShare.Read))
                    {
                        await stream.CopyToAsync(fs);
                    }

                    await Context.Channel.SendFileAsync("output.png");
                }

            File.Delete("output.png");
            return(CustomResult.FromSuccess());
        }
Exemple #5
0
        public async Task <RuntimeResult> ShowEmoteStats([Optional] string range)
        {
            if (CommandHandler.FeatureFlagDisabled(FeatureFlag.EMOTE_TRACKING))
            {
                return(CustomResult.FromIgnored());
            }
            TimeSpan fromWhere;
            DateTime startDate;

            if (range != null)
            {
                fromWhere = Extensions.GetTimeSpanFromString(range);
                startDate = DateTime.Now - fromWhere;
            }
            else
            {
                startDate = DateTime.MinValue;
            }

            var embedsToPost = new List <Embed>();

            AddEmbedsOfEmotes(embedsToPost, startDate, false, "Static emotes");
            AddEmbedsOfEmotes(embedsToPost, startDate, true, "Animated emotes");

            foreach (var embed in embedsToPost)
            {
                await Context.Channel.SendMessageAsync(embed : embed);

                await Task.Delay(500);
            }
            return(CustomResult.FromSuccess());
        }
        public async Task <RuntimeResult> ToggleGroupDisabled(string groupName, bool newValue)
        {
            new ChannelManager().setGroupDisabledTo(groupName, newValue);
            await Task.CompletedTask;

            return(CustomResult.FromSuccess());
        }
Exemple #7
0
        public async Task <RuntimeResult> UnsubscribeFromThread()
        {
            if (CommandHandler.FeatureFlagDisabled(FeatureFlag.MODMAIL))
            {
                return(CustomResult.FromIgnored());
            }
            var bot = Global.Bot;

            using (var db = new Database())
            {
                var existing = db.ThreadSubscribers.AsQueryable().Where(sub => sub.ModMailThreadId == Context.Channel.Id && sub.UserId == Context.User.Id);
                if (existing.Count() == 0)
                {
                    return(CustomResult.FromError("You are not subscribed!"));
                }
            }
            using (var db = new Database())
            {
                var existing = db.ThreadSubscribers.AsQueryable().Where(sub => sub.ModMailThreadId == Context.Channel.Id && sub.UserId == Context.User.Id).First();
                db.ThreadSubscribers.Remove(existing);
                db.SaveChanges();
            }
            await Task.CompletedTask;

            return(CustomResult.FromSuccess());
        }
        public async Task <RuntimeResult> ToggleChannelGroupAttributes(string groupName, bool xpGain, [Optional] bool?profanityCheck, [Optional] Boolean?inviteCheck)
        {
            new ChannelManager().SetChannelGroupAttributes(groupName, xpGain, inviteCheck, profanityCheck);
            await Task.CompletedTask;

            return(CustomResult.FromSuccess());
        }
Exemple #9
0
        public async Task <RuntimeResult> OBanAsync(ulong name, [Remainder] string reason = null)
        {
            if (CommandHandler.FeatureFlagDisabled(FeatureFlag.MODERATION))
            {
                return(CustomResult.FromIgnored());
            }
            var banLogChannel = Context.Guild.GetTextChannel(Global.PostTargets[PostTarget.BAN_LOG]);
            await Context.Guild.AddBanAsync(name, 0, reason);

            MuteTimerManager.UnMuteUserCompletely(name);


            if (reason == null)
            {
                reason = "No reason provided.";
            }

            var banMessage = new EmbedBuilder()
                             .WithColor(9896005)
                             .WithTitle("⛔️ Banned User")
                             .AddField("UserId", name, true)
                             .AddField("By", Extensions.FormatUserNameDetailed(Context.User), true)
                             .AddField("Reason", reason)
                             .AddField("Link", Extensions.FormatLinkWithDisplay("Jump!", Context.Message.GetJumpUrl()));

            await banLogChannel.SendMessageAsync(embed : banMessage.Build());

            return(CustomResult.FromSuccess());
        }
Exemple #10
0
        public async Task <RuntimeResult> SubscribeToThread()
        {
            if (CommandHandler.FeatureFlagDisabled(FeatureFlag.MODMAIL))
            {
                return(CustomResult.FromIgnored());
            }
            var bot = Global.Bot;

            using (var db = new Database())
            {
                var existing = db.ThreadSubscribers.AsQueryable().Where(sub => sub.ModMailThreadId == Context.Channel.Id && sub.UserId == Context.User.Id);
                if (existing.Count() > 0)
                {
                    return(CustomResult.FromError("You are already subscribed!"));
                }
            }
            var subscription = new ThreadSubscriber();

            subscription.ModMailThreadId = Context.Channel.Id;
            subscription.UserId          = Context.User.Id;
            using (var db = new Database())
            {
                db.ThreadSubscribers.Add(subscription);
                db.SaveChanges();
            }
            await Task.CompletedTask;

            return(CustomResult.FromSuccess());
        }
Exemple #11
0
        public async Task <RuntimeResult> OBanAsync(ulong name, [Remainder] string reason = null)
        {
            var modlog = Context.Guild.GetTextChannel(Global.Channels["modlog"]);
            await Context.Guild.AddBanAsync(name, 0, reason);

            return(CustomResult.FromSuccess());
        }
        public async Task <RuntimeResult> RemoveChannelGroup(string name)
        {
            new ChannelManager().RemoveChannelGroup(name);
            await Task.CompletedTask;

            return(CustomResult.FromSuccess());
        }
Exemple #13
0
        public async Task <RuntimeResult> Purge(int messageCount)
        {
            if (messageCount > 100)
            {
                return(CustomResult.FromError("You cannot purge more than 100 messages at a time"));
            }
            // Check if the amount provided by the user is positive.
            if (messageCount <= 0)
            {
                return(CustomResult.FromError("You cannot purge a negative number"));
            }
            var messages = await Context.Channel.GetMessagesAsync(messageCount).FlattenAsync();

            var filteredMessages = messages.Where(x => (DateTimeOffset.UtcNow - x.Timestamp).TotalDays <= 14);

            // Get the total amount of messages.
            var count = filteredMessages.Count();

            // Check if there are any messages to delete.
            if (count == 0)
            {
                return(CustomResult.FromError("Nothing to delete."));
            }
            else
            {
                await(Context.Channel as ITextChannel).DeleteMessagesAsync(filteredMessages);
                await ReplyAndDeleteAsync($"Done. Removed {count} {(count > 1 ? "messages" : "message")}.");

                return(CustomResult.FromSuccess());
            }
        }
        public async Task <RuntimeResult> ShowProfanities(IGuildUser user)
        {
            using (var db = new Database()){
                var allProfanities    = db.Profanities.Where(pro => pro.UserId == user.Id);
                var actualProfanities = allProfanities.Where(pro => pro.Valid == true).Count();
                var falseProfanities  = allProfanities.Where(pro => pro.Valid == false).Count();
                var builder           = new EmbedBuilder();
                builder.AddField(f => {
                    f.Name     = "Actual";
                    f.Value    = actualProfanities;
                    f.IsInline = true;
                });

                builder.AddField(f => {
                    f.Name     = "False positives";
                    f.Value    = falseProfanities;
                    f.IsInline = true;
                });

                builder.WithAuthor(new EmbedAuthorBuilder().WithIconUrl(user.GetAvatarUrl()).WithName(Extensions.FormatUserName(user)));
                await Context.Channel.SendMessageAsync(embed : builder.Build());

                return(CustomResult.FromSuccess());
            }
        }
Exemple #15
0
        public async Task <RuntimeResult> NewsAsync([Remainder] string news)
        {
            var guild = Context.Guild;

            var user           = (SocketGuildUser)Context.Message.Author;
            var newsChannel    = guild.GetTextChannel(Global.Channels["news"]);
            var newsRole       = guild.GetRole(Global.Roles["news"]);
            var journalistRole = guild.GetRole(Global.Roles["journalist"]);

            if (news.Contains("@everyone") || news.Contains("@here") || news.Contains("@news"))
            {
                return(CustomResult.FromError("Your news article contained one or more illegal pings!"));
            }


            if (!user.Roles.Contains(journalistRole))
            {
                return(CustomResult.FromError("Only Journalists can post news."));
            }

            await newsRole.ModifyAsync(x => x.Mentionable = true);

            await newsChannel.SendMessageAsync(news + Environment.NewLine + Environment.NewLine + newsRole.Mention + Environment.NewLine + "- " + Context.Message.Author);

            await newsRole.ModifyAsync(x => x.Mentionable = false);

            return(CustomResult.FromSuccess());
        }
        public async Task <RuntimeResult> ReloadDB()
        {
            await Task.Delay(500);

            Global.LoadGlobal();
            return(CustomResult.FromSuccess());
        }
Exemple #17
0
        public async Task <RuntimeResult> BanAsync(IGuildUser user, [Remainder] string reason = null)
        {
            if (user.IsBot)
            {
                return(CustomResult.FromError("You can't ban bots."));
            }

            if (user.GuildPermissions.PrioritySpeaker)
            {
                return(CustomResult.FromError("You can't ban staff."));
            }
            try
            {
                const string banMessage = "You were banned on r/OnePlus for the following reason: {0}\n" +
                                          "If you believe this to be a mistake, please send an appeal e-mail with all the details to [email protected]";
                await user.SendMessageAsync(string.Format(banMessage, reason));

                await Context.Guild.AddBanAsync(user, 0, reason);

                return(CustomResult.FromSuccess());
            }
            catch (Exception ex)
            {
                //  may not be needed
                // await Context.Guild.AddBanAsync(user, 0, reason);
                return(CustomResult.FromError(ex.Message));
            }
        }
Exemple #18
0
        public async Task <RuntimeResult> EnableModmailForUser(IGuildUser user)
        {
            new  ModMailManager().EnableModmailForUser(user);
            await Task.CompletedTask;

            return(CustomResult.FromSuccess());
        }
        public async Task <RuntimeResult> WarnAsync(IGuildUser user, [Optional][Remainder] string reason)
        {
            var warningsChannel = Context.Guild.GetTextChannel(Global.PostTargets[PostTarget.WARN_LOG]);

            var monitor = Context.Message.Author;

            var entry = new WarnEntry
            {
                WarnedUser   = user.Username + '#' + user.Discriminator,
                WarnedUserID = user.Id,
                WarnedBy     = monitor.Username + '#' + monitor.Discriminator,
                WarnedByID   = monitor.Id,
                Reason       = reason,
                Date         = Context.Message.Timestamp.DateTime,
            };

            using (var db = new Database())
            {
                db.Warnings.Add(entry);
                db.SaveChanges();
            }

            var builder = new EmbedBuilder();

            builder.Title = "...a new warning has emerged from outer space!";
            builder.Color = new Color(0x3E518);

            builder.Timestamp = Context.Message.Timestamp;

            builder.WithFooter(footer =>
            {
                footer
                .WithText("Case #" + entry.ID)
                .WithIconUrl("https://a.kyot.me/0WPy.png");
            });

            builder.ThumbnailUrl = user.GetAvatarUrl();

            builder.WithAuthor(author =>
            {
                author
                .WithName("Woah...")
                .WithIconUrl("https://a.kyot.me/cno0.png");
            });

            const string discordUrl = "https://discordapp.com/channels/{0}/{1}/{2}";

            builder.AddField("Warned User", Extensions.FormatMentionDetailed(user))
            .AddField("Warned by", Extensions.FormatMentionDetailed(monitor))
            .AddField(
                "Location of the incident",
                $"[#{Context.Message.Channel.Name}]({string.Format(discordUrl, Context.Guild.Id, Context.Channel.Id, Context.Message.Id)})")
            .AddField("Reason", reason ?? "No reason was provided.");

            var embed = builder.Build();
            await warningsChannel.SendMessageAsync(null, embed : embed).ConfigureAwait(false);

            return(CustomResult.FromSuccess());
        }
Exemple #20
0
        public async Task <RuntimeResult> ShowLeaderboard([Optional] int page)
        {
            if (CommandHandler.FeatureFlagDisabled(FeatureFlag.EXPERIENCE))
            {
                return(CustomResult.FromIgnored());
            }
            var embedBuilder = new EmbedBuilder();

            using (var db = new Database())
            {
                var allUsers           = db.Users.AsQueryable().OrderByDescending(us => us.XP).ToList();
                var usersInLeaderboard = db.Users.AsQueryable().OrderByDescending(us => us.XP);
                System.Collections.Generic.List <User> usersToDisplay;
                if (page > 1)
                {
                    usersToDisplay = usersInLeaderboard.Skip((page - 1) * 10).Take(10).ToList();
                }
                else
                {
                    usersToDisplay = usersInLeaderboard.Take(10).ToList();
                }
                embedBuilder = embedBuilder.WithTitle("Leaderboard of gained experience");
                var description = new StringBuilder();
                if (page * 10 > allUsers.Count())
                {
                    description.Append("Page not found. \n");
                }
                else
                {
                    description.Append("Rank | Name | Experience | Level | Messages \n");
                    foreach (var user in usersToDisplay)
                    {
                        var rank        = allUsers.IndexOf(user) + 1;
                        var userInGuild = Context.Guild.GetUser(user.Id);
                        var name        = userInGuild != null?Extensions.FormatUserName(userInGuild) : "User left guild " + user.Id;

                        description.Append($"[#{rank}] → **{name}**\n");
                        description.Append($"XP: {user.XP} | Level: {user.Level} | Messages: {user.MessageCount} \n \n");
                    }
                    description.Append("\n");
                }

                description.Append("Your placement: \n");
                var caller = db.Users.AsQueryable().Where(us => us.Id == Context.Message.Author.Id).FirstOrDefault();
                if (caller != null)
                {
                    var callRank    = allUsers.IndexOf(caller) + 1;
                    var userInGuild = Context.Guild.GetUser(caller.Id);
                    description.Append($"[#{callRank}] → *{Extensions.FormatUserName(userInGuild)}* XP: {caller.XP} messages: {caller.MessageCount} \n");
                    description.Append($"Level: {caller.Level}");
                }
                embedBuilder = embedBuilder.WithDescription(description.ToString());
                embedBuilder.WithFooter(new EmbedFooterBuilder().WithText("Use leaderboard <page> to view more of the leaderboard"));
                await Context.Channel.SendMessageAsync(embed : embedBuilder.Build());
            }

            return(CustomResult.FromSuccess());
        }
Exemple #21
0
 public async Task <RuntimeResult> PostNicknameResponse()
 {
     if (CommandHandler.FeatureFlagDisabled(FeatureFlag.MODMAIL))
     {
         return(CustomResult.FromIgnored());
     }
     await new ModMailManager().RespondWithUsernameTemplateAndSetReminder(Context.Channel, Context.User, Context.Message);
     return(CustomResult.FromSuccess());
 }
Exemple #22
0
 public async Task <RuntimeResult> SetupInfoPost()
 {
     if (CommandHandler.FeatureFlagDisabled(FeatureFlag.ASSIGNABLE_ROLES))
     {
         return(CustomResult.FromIgnored());
     }
     await new SelfAssignabeRolesManager().SetupInfoPost();
     return(CustomResult.FromSuccess());
 }
Exemple #23
0
        public async Task <RuntimeResult> BanAsync(IGuildUser user, [Remainder] string reason = null)
        {
            if (CommandHandler.FeatureFlagDisabled(FeatureFlag.MODERATION))
            {
                return(CustomResult.FromIgnored());
            }
            if (user.IsBot)
            {
                return(CustomResult.FromError("You can't ban bots."));
            }


            if (user.GuildPermissions.PrioritySpeaker)
            {
                return(CustomResult.FromError("You can't ban staff."));
            }


            if (reason == null)
            {
                reason = "No reason provided.";
            }
            try
            {
                try
                {
                    const string banDMMessage = "You were banned on r/OnePlus for the following reason: {0}\n" +
                                                "If you believe this to be a mistake, please send an appeal e-mail with all the details to [email protected]";
                    await user.SendMessageAsync(string.Format(banDMMessage, reason));
                } catch (HttpException) {
                    await Context.Channel.SendMessageAsync("Seems like user disabled DMs, cannot send message about the ban.");
                }

                await Context.Guild.AddBanAsync(user, 0, reason);

                MuteTimerManager.UnMuteUserCompletely(user.Id);

                var banLogChannel = Context.Guild.GetTextChannel(Global.PostTargets[PostTarget.BAN_LOG]);
                var banlog        = new EmbedBuilder()
                                    .WithColor(9896005)
                                    .WithTitle("⛔️ Banned User")
                                    .AddField("User", Extensions.FormatUserNameDetailed(user), true)
                                    .AddField("By", Extensions.FormatUserNameDetailed(Context.User), true)
                                    .AddField("Reason", reason)
                                    .AddField("Link", Extensions.FormatLinkWithDisplay("Jump!", Context.Message.GetJumpUrl()));

                await banLogChannel.SendMessageAsync(embed : banlog.Build());

                return(CustomResult.FromSuccess());
            }
            catch (Exception ex)
            {
                //  may not be needed
                // await Context.Guild.AddBanAsync(user, 0, reason);
                return(CustomResult.FromError(ex.Message));
            }
        }
Exemple #24
0
        public async Task <RuntimeResult> HandleRemindInput(params string[] arguments)
        {
            if (arguments.Length < 1)
            {
                return(CustomResult.FromError("The correct usage is `;remind <duration> <text>`"));
            }

            string durationStr = arguments[0];


            TimeSpan span       = Extensions.GetTimeSpanFromString(durationStr);
            DateTime targetTime = DateTime.Now.Add(span);

            string reminderText;

            if (arguments.Length > 1)
            {
                string[] reminderParts = new string[arguments.Length - 1];
                Array.Copy(arguments, 1, reminderParts, 0, arguments.Length - 1);
                reminderText = string.Join(" ", reminderParts);
            }
            else
            {
                return(CustomResult.FromError("You need to provide a text."));
            }

            var author = Context.Message.Author;

            var guild = Context.Guild;

            var reminder = new Reminder();

            reminder.RemindText     = Extensions.RemoveIllegalPings(reminderText);
            reminder.RemindedUserId = author.Id;
            reminder.TargetDate     = targetTime;
            reminder.ReminderDate   = DateTime.Now;
            reminder.ChannelId      = Context.Channel.Id;
            reminder.MessageId      = Context.Message.Id;

            using (var db = new Database())
            {
                db.Reminders.Add(reminder);
                db.SaveChanges();
                if (targetTime <= DateTime.Now.AddMinutes(60))
                {
                    var difference = targetTime - DateTime.Now;
                    ReminderTimerManger.RemindUserIn(author.Id, difference, reminder.ID);
                    reminder.ReminderScheduled = true;
                }

                db.SaveChanges();
            }

            await Context.Channel.SendMessageAsync($"{Context.User.Mention} Scheduled reminder id {reminder.ID}.");

            return(CustomResult.FromSuccess());
        }
Exemple #25
0
        public async Task <RuntimeResult> PrintStarStats()
        {
            if (CommandHandler.FeatureFlagDisabled(FeatureFlag.STARBOARD))
            {
                return(CustomResult.FromIgnored());
            }
            var mostStars = new Dictionary <ulong, ulong>();

            using (var db = new Database())
            {
                var mostStarredMessages = db.StarboardMessages.AsQueryable().Where(p => !p.Ignored).OrderByDescending(p => p.Starcount).Take(3).ToArray();
                var starMessagesCount   = db.StarboardMessages.AsQueryable().Where(p => !p.Ignored).Count();
                // we could either store the ignored flag in the relation as well and duplicate the flag, or we could join here...
                var totalStarsCount = db.StarboardPostRelations.Include(message => message.Message).Where(message => !message.Message.Ignored).Count();

                var mostStarerUser = db.StarboardPostRelations
                                     .Include(message => message.Message)
                                     .Where(message => !message.Message.Ignored)
                                     .GroupBy(p => p.UserId)
                                     .Select(g => new { id = g.Key, count = g.Count() })
                                     .OrderByDescending(p => p.count)
                                     .Select(p => new KeyValuePair <ulong, int>(p.id, p.count))
                                     .ToArray();

                var mostStarRecieverUser = db.StarboardMessages
                                           .AsQueryable().Where(p => !p.Ignored)
                                           .GroupBy(p => p.AuthorId)
                                           .Select(g => new { id = g.Key, count = g.Sum(p => p.Starcount) })
                                           .OrderByDescending(p => p.count)
                                           .Select(p => new KeyValuePair <ulong, int>(p.id, (int)p.count))
                                           .ToArray();

                var embed = new EmbedBuilder();
                embed.WithTitle("Server Starboard stats");
                embed.WithDescription($"{starMessagesCount} starred messages with {totalStarsCount} stars in total");
                var badges = new List <String>();
                badges.Add("🥇");
                badges.Add("🥈");
                badges.Add("🥉");
                var firstPostField = new EmbedFieldBuilder()
                                     .WithName("Top starred posts")
                                     .WithValue(BuildStringForMessage(mostStarredMessages, badges));

                var secondPostField = new EmbedFieldBuilder()
                                      .WithName("Top star receiver")
                                      .WithValue(BuildStringForPoster(mostStarRecieverUser, badges));

                var thirdPostField = new EmbedFieldBuilder()
                                     .WithName("Top star givers")
                                     .WithValue(BuildStringForPoster(mostStarerUser, badges));
                embed.WithFields(firstPostField);
                embed.WithFields(secondPostField);
                embed.WithFields(thirdPostField);
                await Context.Channel.SendMessageAsync(embed : embed.Build());
            }
            return(CustomResult.FromSuccess());
        }
Exemple #26
0
        public async Task <RuntimeResult> SetNicknameTo(IGuildUser user, [Optional][Remainder] string newNickname)
        {
            if (CommandHandler.FeatureFlagDisabled(FeatureFlag.MODERATION))
            {
                return(CustomResult.FromIgnored());
            }
            await user.ModifyAsync((user) => user.Nickname = newNickname);

            return(CustomResult.FromSuccess());
        }
Exemple #27
0
        public async Task <RuntimeResult> DeleteMessage(params string[] parameters)
        {
            if (parameters.Length < 1)
            {
                return(CustomResult.FromError("Required parameter: <messageId>"));
            }
            ulong messageId = (ulong)Convert.ToUInt64(parameters[0]);

            await new  ModMailManager().DeleteMessage(messageId, Context.Channel, Context.User);
            return(CustomResult.FromSuccess());
        }
Exemple #28
0
        public async Task <RuntimeResult> SetExpGainEnabled(IGuildUser user, bool newValue)
        {
            if (CommandHandler.FeatureFlagDisabled(FeatureFlag.EXPERIENCE))
            {
                return(CustomResult.FromIgnored());
            }
            new ExpManager().SetXPDisabledTo(user, newValue);
            await Task.CompletedTask;

            return(CustomResult.FromSuccess());
        }
Exemple #29
0
        public async Task <RuntimeResult> EnableModmailForUser(IGuildUser user)
        {
            if (CommandHandler.FeatureFlagDisabled(FeatureFlag.MODMAIL))
            {
                return(CustomResult.FromIgnored());
            }
            new  ModMailManager().EnableModmailForUser(user);
            await new ModMailManager().SendModmailUnmutedNotification(user, Context.User);
            await Task.CompletedTask;

            return(CustomResult.FromSuccess());
        }
        public async Task <RuntimeResult> RemoveFromChannelGroup(string groupName, [Remainder] string text)
        {
            var parts = text.Split(' ');

            if (parts.Length < 1)
            {
                return(CustomResult.FromError("syntax <name> <mentioned channels to be added>"));
            }
            new ChannelManager().removeChannelsFromGroup(groupName, Context.Message);
            await Task.CompletedTask;

            return(CustomResult.FromSuccess());
        }