Example #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);
        }
Example #2
0
 public async Task CurrentActivity()
 {
     await Context.Channel.SendMessageAsync(ChannelCounter.PrintCurrent());
 }