public async Task SetServerActivivtyLogOff()
        {
            var guild = _globalGuildAccounts.GetFromDiscordGuild(Context.Guild);

            guild.LogChannelId      = 0;
            guild.ServerActivityLog = 0;
            _globalGuildAccounts.SaveAccounts(Context.Guild.Id);

            await ReplyAsync("No more Logging");
        }
Exemple #2
0
        public RoleByPhraseOperationResult AddPhrase(IGuild guild, string phrase)
        {
            var guildSettings = _globalGuildAccounts.GetFromDiscordGuild(guild);

            try
            {
                guildSettings.RoleByPhraseSettings.AddPhrase(phrase);
                _globalGuildAccounts.SaveAccounts();
                return(RoleByPhraseOperationResult.Success);
            }
            catch (PhraseAlreadyAddedException)
            {
                return(RoleByPhraseOperationResult.AlreadyExists);
            }
            catch (Exception)
            {
                return(RoleByPhraseOperationResult.Failed);
            }
        }
        public async Task RbpStatus()
        {
            var rbp = _globalGuildAccounts.GetFromDiscordGuild(Context.Guild).RoleByPhraseSettings;

            var phrases   = rbp.Phrases.Any() ? string.Join("\n", rbp.Phrases.Select(p => $"({rbp.Phrases.IndexOf(p)}) - {p}")) : "No phrases stored\nAdd one with `rbp addPhrase YOUR-PHRASE`";
            var roles     = rbp.RolesIds.Any() ? string.Join("\n", rbp.RolesIds.Select(r => $"({rbp.RolesIds.IndexOf(r)}) - {Context.Guild.GetRole(r).Name}")) : "No roles stored\nAdd one with `rbp addRole @SomeRole`";
            var relations = rbp.Relations.Any() ? string.Join("\n", rbp.Relations.Select(r => $"Phrase {r.PhraseIndex} => Role {r.RoleIdIndex}")) : "No relations created\nAdd one with `rbp addRelation PHRASE-ID ROLE-ID`";

            var embed = new EmbedBuilder();

            embed.WithColor(Color.Blue);
            embed.WithTitle($"Role Assignments for {Context.Guild.Name}");
            embed.AddField("Phrases", phrases);
            embed.AddField("Roles", roles);
            embed.AddField("Relations", relations);
            embed.WithFooter(Global.GetRandomDidYouKnow());
            embed.WithCurrentTimestamp();

            await Context.Channel.SendMessageAsync("", embed : embed.Build());
        }