Beispiel #1
0
 public void TrySaveGuild(BaseGuild guild)
 {
     if (Check.NotNull(guild))
     {
         SaveGuild(guild);
     }
 }
Beispiel #2
0
 internal EventContext(BaseGuild server, SocketGuild guild, SocketGuildUser user)
 {
     Server     = server;
     Guild      = guild;
     User       = user;
     ReceivedAt = DateTime.UtcNow;
 }
Beispiel #3
0
        public void AddOrUpdateGuild(ulong id, BaseGuild guild)
        {
            if (id != guild.Id)
            {
                throw new Exception("The IDs do not match.");
            }

            Guilds.Values.AddOrUpdate(guild.Id, guild, (key, value) => guild);
        }
Beispiel #4
0
        public BaseGuild GetOrAddGuild(IGuild guild)
        {
            BaseGuild account;

            if (!Guilds.Values.ContainsKey(guild.Id))
            {
                account = new BaseGuild(guild);
                Guilds.Values.AddOrUpdate(guild.Id, account, (key, value) => account);
                return(account);
            }

            Guilds.Values.TryGetValue(guild.Id, out account);
            return(account);
        }
Beispiel #5
0
 public bool TryGetGuild(ulong id, out BaseGuild guild)
 => Guilds.TryGet(id, out guild);
Beispiel #6
0
 // saves the guild to its directory
 public void SaveGuild(BaseGuild guild)
 {
     Guilds.Values.AddOrUpdate(guild.Id, guild, (key, value) => guild);
     JsonHandler.SaveJsonEntity(guild);
 }