public async Task AgreeToTheRules() { if (Context.IsPrivate == true) { return; } if (!RoleCheck.HasClerkRole((SocketGuildUser)Context.User) && !RoleCheck.HasDiplomatRole((SocketGuildUser)Context.User)) { var guildUser = Context.User as IGuildUser; var memberRole = Context.Guild.GetRole(RoleIds.roles.applicantID); await guildUser.AddRoleAsync(memberRole); var user = Context.User; await Context.Channel.SendMessageAsync($"{user.Mention} has agreed to the rules and is a {memberRole}"); } }
public async Task GrantTownMembership(IGuildUser applicant) { if (Context.IsPrivate == true) { return; } if (RoleCheck.HasInvestmentStaffRole((SocketGuildUser)Context.User) || RoleCheck.HasRecruiterRole((SocketGuildUser)Context.User)) { if (RoleCheck.HasApplicantRole((SocketGuildUser)applicant) && !RoleCheck.HasDiplomatRole((SocketGuildUser)applicant)) { var guildUser = applicant; var role = Context.Guild.GetRole(RoleIds.roles.guildMemberID); var oldRole = Context.Guild.GetRole(RoleIds.roles.applicantID); await guildUser.AddRoleAsync(role); await guildUser.RemoveRoleAsync(oldRole); await Context.Channel.SendMessageAsync($"{guildUser.Mention} now has the `{role}` role! This was granted by {Context.User}"); } } }
public async Task Diplomat(SocketGuildUser user, [Remainder] string guild) { if (Context.IsPrivate == true) { return; } var diplomatLog = Global.Client.GetGuild(Config.bot.guildID).GetTextChannel(ChannelIds.channels.diplomatLogID); if (RoleCheck.HasInvestmentStaffRole((SocketGuildUser)Context.User) || RoleCheck.HasRecruiterRole((SocketGuildUser)Context.User)) { if (RoleCheck.HasClerkRole((SocketGuildUser)user)) { await ReplyAsync("Role conflict. Unable to assign the Diplomat role."); return; } var target = user as IGuildUser; var memberRole = Context.Guild.GetRole(RoleIds.roles.diplomatID); await target.AddRoleAsync(memberRole); await diplomatLog.SendMessageAsync($"{target.Mention} is from the {guild}"); } }