Skip to content

Commit

Permalink
convert verifications to send to only stephen
Browse files Browse the repository at this point in the history
  • Loading branch information
stephendotgg committed Mar 17, 2024
1 parent ddd51cb commit 4842787
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 32 deletions.
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ SHOWCASE_CHANNEL_ID=
NEWS_CHANNEL_ID=
COUNTING_CHANNEL_ID=
VOICE_CHANNEL_ID=
VERIFICATION_CHANNEL_ID=

CHAT_CATEGORY=

STUDENT_ROLE_ID=
SUPPORT_ROLE_ID=
STAFF_ROLE_ID=
MANAGEMENT_ROLE_ID=
VERIFIER_ROLE_ID=

STEPHEN_USER_ID=

RIGHT_ARROW_EMOJI_ID=
UPVOTE_EMOJI_ID=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ class VerificationListener : ListenerAdapter() {
if (e.button.id!!.startsWith("v|")) {
val guild = e.guild!!

val roleIds = e.member!!.roles.map { it.id }
if (!roleIds.contains(Environment.get("SUPPORT_ROLE_ID")) && !roleIds.contains(Environment.get("STAFF_ROLE_ID")) && !roleIds.contains(Environment.get("VERIFIER_ROLE_ID")) && !roleIds.contains(Environment.get("MANAGEMENT_ROLE_ID"))) {
if (e.member!!.id != "676926873669992459" && e.member!!.id != "259780560707256321") {
e.reply("Sorry, you can't verify student profiles.").setEphemeral(true).queue()
return
}
Expand Down Expand Up @@ -110,42 +109,24 @@ class VerificationListener : ListenerAdapter() {
).queue(null, ErrorHandler().handle(ErrorResponse.CANNOT_SEND_TO_USER) {})
}
}
"ch" -> {
description = "hasn't approved :mention:, as they're unable to view their courses"

member.user.openPrivateChannel().complete().let {
it.sendMessageEmbeds(
embed()
.setTitle("Profile Verification")
.setDescription("""
Staff looked at your profile and found that you have got privacy settings disabled which means we can't see your courses.
Change here: <https://www.udemy.com/instructor/profile/privacy/>
Enable "Show courses you're taking on your profile page" and verify again!
""")
.build()
).queue(null, ErrorHandler().handle(ErrorResponse.CANNOT_SEND_TO_USER) {})
}
}
"no" -> {
description = "hasn't approved :mention:, as they do not own the course"

member.user.openPrivateChannel().complete().let {
it.sendMessageEmbeds(
embed()
.setTitle("Profile Verification")
.setDescription("Staff looked at your profile and found that you do not own the course!\n\nWas this a mistake? Head to " + guild.getTextChannelById(Environment.get("QUESTIONS_CHANNEL_ID"))!!.asMention + " and solve this with staff.")
.setDescription("Staff looked at your profile and found that you do not own the course! Are you on the Udemy Personal Plan or Udemy For Business? If so, head to " + guild.getTextChannelById(Environment.get("QUESTIONS_CHANNEL_ID"))!!.asMention + " and let staff know.")
.build()
).queue(null, ErrorHandler().handle(ErrorResponse.CANNOT_SEND_TO_USER) {})
}
}
"undo" -> {
val originalActionTaker = info[4]
if (e.member!!.id != originalActionTaker && !roleIds.contains(Environment.get("MANAGEMENT_ROLE_ID"))) {
"u" -> {
if (e.member!!.id != "676926873669992459" && e.member!!.id != "259780560707256321") {
e.reply("Sorry, you can't undo that verification decision.").setEphemeral(true).queue()
return
}

guild.removeRoleFromMember(member, guild.getRoleById(Environment.get("STUDENT_ROLE_ID"))!!).queue()
e.message.editMessageEmbeds(
embed()
Expand All @@ -157,7 +138,6 @@ class VerificationListener : ListenerAdapter() {
.setActionRow(
Button.success("v|a|" + url + "|" + member.id, "Approve"),
Button.danger("v|wl|" + url + "|" + member.id, "Wrong Link"),
Button.danger("v|ch|" + url + "|" + member.id, "Courses Hidden"),
Button.danger("v|no|" + url + "|" + member.id, "Not Owned"))
.queue()

Expand All @@ -182,7 +162,7 @@ class VerificationListener : ListenerAdapter() {
.setDescription(e.member!!.asMention + " " + description.replace(":mention:", member.asMention) + ".")
.build())
.setActionRow(
Button.danger("v|undo|" + url + "|" + member.id + "|" + e.member!!.id, "Undo"))
Button.danger("v|u|" + url + "|" + member.id + "|" + e.member!!.id, "Undo"))
.queue()

e.interaction.deferEdit().queue()
Expand Down Expand Up @@ -218,26 +198,25 @@ class VerificationListener : ListenerAdapter() {
embed()
.setTitle("Your profile has been received!")
.setDescription("""
Please wait a few moments as staff verify that you own the course. Once verified, this channel will disappear and you'll be able to talk in the rest of the server.
Please wait a short while as staff verify that you own the course! Once verified, this channel will disappear and you'll be able to talk in the rest of the server.
If you have any concerns, please ask in <#${Environment.get("QUESTIONS_CHANNEL_ID")}""" + ">." + """
""")
.build()).setEphemeral(true).queue()


e.jda.getTextChannelById(Environment.get("SUPPORT_CHANNEL_ID"))!!.apply {
sendMessage(e.jda.getRoleById(Environment.get("VERIFIER_ROLE_ID"))!!.asMention).queue {msg -> msg.delete().queue()}
e.jda.getTextChannelById(Environment.get("VERIFICATION_CHANNEL_ID"))!!.apply {
sendMessage(guild.retrieveMemberById(Environment.get("STEPHEN_USER_ID")).complete().asMention).complete()
sendMessageEmbeds(
embed()
.setTitle("Profile Verification")
.setDescription("Please verify that " + e.member!!.asMention + " owns the course.")
.setDescription("Verify that " + e.member!!.asMention + " owns the course.")
.addField("Udemy Link", url, false)
.build())
.addActionRow(
Button.success("v|a|" + url + "|" + e.member!!.id, "Approve"),
Button.danger("v|wl|" + url + "|" + e.member!!.id, "Wrong Link"),
Button.danger("v|ch|" + url + "|" + e.member!!.id, "Courses Hidden"),
Button.danger("v|no|" + url + "|" + e.member!!.id, "Not Owned")
).queue()
}
Expand Down

0 comments on commit 4842787

Please sign in to comment.