コード例 #1
0
        public void AddNewChannelCounter(ulong guildId, ChannelCounter counter)
        {
            var guild    = _guild.GetOrCreateGuildAccount(guildId);
            var fCounter = guild.ChannelCounters.Find(x => x.Type == counter.Type);
            var cCounter = guild.ChannelCounters.Find(x => x.ChannelId == counter.ChannelId);

            if (fCounter != null)
            {
                throw new Exception($"A counter of this type already exists. (channel id: {fCounter.ChannelId})");
            }
            else if (cCounter != null)
            {
                throw new Exception($"This channel already has the '{cCounter.Type}' active.");
            }


            guild.ChannelCounters.Add(counter);
            _guild.SaveGuildAccount(guild);
        }
コード例 #2
0
ファイル: GuildCommands.cs プロジェクト: cprogrammer9/Nepbot
 public async Task CurrentActivity()
 {
     await Context.Channel.SendMessageAsync(ChannelCounter.PrintCurrent());
 }