Esempio n. 1
0
        public static async Task <Guild> GetGuildAsync(ulong id, StorageClient storageClient)
        {
            // might want to cache these guilds eventually
            var guild = await storageClient.GetTableRow <Guild>(Guild.TableName, id.ToString(), Guild.PartitionKeyConst);

            if (guild == null)
            {
                GuildIdMappings.recruitingChannels.TryGetValue(id, out ulong recruitingChannelId);
                GuildIdMappings.inhouseChannels.TryGetValue(id, out ulong inhouseChannelId);
                GuildIdMappings.rolesChannels.TryGetValue(id, out ulong rolesChannelId);
                guild = new Guild
                {
                    Id = id,
                    RecruitingChannelId = recruitingChannelId,
                    InhouseChannelId    = inhouseChannelId,
                    RolesChannelId      = rolesChannelId
                };

                await storageClient.SaveTableRow(TableName, guild.RowKey, PartitionKeyConst, guild);
            }

            return(guild);
        }