Ejemplo n.º 1
0
        public async Task SetLeave(ulong channelId)
        {
            var guild = await GuildQueries.FindOrCreateGuild(Module.Context.Guild.Id);

            guild.LeaveId = channelId;
            await GuildQueries.Update(guild);

            await SendMessageAsync("`Set this channel as leave message channel!`");
        }
Ejemplo n.º 2
0
        public async Task RestrictGuild(ulong guildId)
        {
            string message;
            var    guild = await GuildQueries.FindOrCreateGuild(guildId);

            if (guild.Restrict)
            {
                guild.Restrict = false;
                message        = $"`Unrestricted guild {guildId} from using Cake!`";
            }
            else
            {
                guild.Restrict = true;
                message        = $"`Restricted guild {guildId} from using Cake!`";
            }
            await GuildQueries.Update(guild);

            await SendMessageAsync(message);
        }
Ejemplo n.º 3
0
        public async Task SetPrefix(string newPrefix)
        {
            try
            {
                if (newPrefix.Length > 4)
                {
                    throw new System.Exception("New prefix is too long for database.");
                }

                var guild = await GuildQueries.FindOrCreateGuild(Module.Context.Guild.Id);

                var oldPrefix = guild.Prefix;
                guild.Prefix = newPrefix;
                await GuildQueries.Update(guild);

                await SendMessageAsync($"``Prefix changed to '{newPrefix}', old prefix was '{oldPrefix}'.``");
            }
            catch
            {
                // WIP
            }
        }
Ejemplo n.º 4
0
 public async Task GetPrefix()
 {
     await SendMessageAsync($"``Current prefix in this server is {GuildQueries.FindOrCreateGuild(Module.Context.Guild.Id).Result.Prefix}.``");
 }