Пример #1
0
        //Set default prefix
        private async Task _client_JoinedGuild(SocketGuild arg)
        {
            if (!_guildRepository.Exists(arg.Id))
            {
                _guildRepository.AddGuild(new Guild()
                {
                    GuildID = arg.Id, Name = arg.Name
                });
            }

            Guild guild = _guildRepository.GetGuildById(arg.Id);

            if (!_prefixRepository.CheckIfGuildHasPrefix(guild.GuildID))
            {
                Prefix pref = new Prefix()
                {
                    PrefixCommand = prefix,
                    Guild         = guild,
                    GuildID       = guild.GuildID
                };

                _prefixRepository.AddPrefix(pref);
            }
            else
            {
                _prefixRepository.ChangePrefix(arg.Id, prefix);
            }

            return;
        }
 private void AddGuildIfNotExist(SocketGuild guild)
 {
     if (!_guildRepo.Exists(guild.Id))
     {
         Guild gui = new Guild()
         {
             GuildID = guild.Id, Name = guild.Name
         };
         _guildRepo.AddGuild(gui);
     }
 }