public async Task UserJoin(SocketGuildUser user) { if (Convert.ToBoolean(JackFrostBot.UserSettings.Roles.LurkerRoleEnabled(user.Guild.Id))) { //Give the new user the Lurker role if enabled var lurkRole = (IRole)user.Guild.GetRole(JackFrostBot.UserSettings.Roles.LurkerRoleID(user.Guild.Id)); var newUser = (IGuildUser)user; if (lurkRole != null) { await newUser.AddRoleAsync(lurkRole); } } int warnLevel = Moderation.WarnLevel(user); var defaultChannel = (SocketTextChannel)user.Guild.GetChannel(JackFrostBot.UserSettings.Channels.WelcomeChannelId(user.Guild.Id)); if (warnLevel >= JackFrostBot.UserSettings.BotOptions.MuteLevel(user.Guild.Id)) { await defaultChannel.SendMessageAsync($"**A user with multiple warns has rejoined: {user.Mention}.** Automatically muting..."); Moderation.Mute(client.CurrentUser.Username, defaultChannel, user); } else if (JackFrostBot.UserSettings.Channels.WelcomeOnJoin(user.Guild.Id)) { await defaultChannel.SendMessageAsync($"**Welcome to the server, {user.Mention}!** {JackFrostBot.UserSettings.BotOptions.GetString("WelcomeMessage", user.Guild.Id)}"); } //Log join/invite in botlogs var botlog = (SocketTextChannel)user.Guild.GetChannel(JackFrostBot.UserSettings.Channels.BotLogsId(user.Guild.Id)); Embed embed = Embeds.LogJoin(user.Guild, user); await botlog.SendMessageAsync("", embed : embed).ConfigureAwait(false); var invites = user.Guild.GetInvitesAsync().Result; JackFrostBot.UserSettings.Invites.Update(user.Guild.Id, invites); }