Advertisement
LawMixer

whole code

Aug 8th, 2023
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.86 KB | None | 0 0
  1. import interactions
  2.  
  3. from interactions import listen, Extension, events, Guild, Embed, Button, ButtonStyle, StringSelectMenu, component_callback, ComponentContext
  4. from interactions import StringSelectOption
  5. from interactions.api.events import Component
  6.  
  7.  
  8. from resources.firebase import firebaseLib
  9. from resources.verify_methods.rover import RoVer
  10. from resources.verify_methods.bloxlink import Bloxlink
  11. from resources.role import PermissionCog
  12.  
  13.  
  14. class VerifyButton(Extension):
  15. def __init__(self, client: interactions.Client):
  16. self.client = client
  17.  
  18. self.selection = StringSelectMenu(
  19. StringSelectOption(
  20. label="Roblox OAuth",
  21. value= "Roblox OAuth",
  22. description="Verify your Roblox Account with Roblox OAuth",
  23. # emoji=self.client.get_custom_emoji(1137546094486765598)
  24. ),
  25.  
  26. StringSelectOption(
  27. label="Bloxlink",
  28. value= "Bloxlink",
  29. description="Verify your Roblox Account with Bloxlink",
  30. # emoji=self.client.get_custom_emoji(1137545583331115090)
  31. ),
  32.  
  33. custom_id="verify_select",
  34. placeholder="Choose Verification Method",
  35. min_values=1,
  36. max_values=1,
  37. )
  38.  
  39. # @listen()
  40. # async def on_ready(self):
  41. # embed = Embed("Orosius Authorization", "This server uses Orosius Authorization. In order to unlock all the features of this server, you'll need to verify your roblox account with your discord account.")
  42.  
  43. # embed.add_field("Please read FAQ", "Please read FAQ channel to answer all of your questions. If your questions aren't answered in there, then please direct message a moderator for assistance.")
  44.  
  45. # channel = await self.client.fetch_channel(1090735315376947231)
  46. # await channel.send(embeds=embed, components=self.selection)
  47.  
  48. @component_callback("verify_select")
  49. async def my_callback(self, ctx: ComponentContext):
  50. await ctx.defer(ephemeral=True)
  51. options = ctx.values
  52. selectedOption = options[0]
  53.  
  54. success, error = None, None
  55.  
  56. print(selectedOption)
  57. if selectedOption == "Roblox OAuth":
  58. userInfo = firebaseLib().fetch_roblox_id_from_discord_id(ctx.author.id)
  59.  
  60. if userInfo != None:
  61. return await ctx.send("You are not verified with Orosius Authorization. Please verify @ https://verify.orosiuslabs.com/", ephemeral=True)
  62.  
  63. elif selectedOption == "Bloxlink":
  64. userInfo = firebaseLib().fetch_roblox_id_from_discord_id(ctx.author.id)
  65.  
  66. if userInfo != None:
  67. return await ctx.send("You already verified with Orosius Authorization.", ephemeral=True)
  68.  
  69. success, error = await Bloxlink().get_roblox_info(ctx.author.id)
  70.  
  71. if success == True:
  72. guild = await self.client.fetch_guild(864557936068395018)
  73. authRole = await guild.fetch_role(1091834304776130581)
  74.  
  75. roleCheck = await PermissionCog().check_role(ctx.author, 1091834304776130581)
  76. unroleCheck = await PermissionCog().check_role(ctx.author, 1106563044248657971)
  77.  
  78. testSub = await PermissionCog().check_role(ctx.author, 941817354734686239)
  79. testSubRole = await guild.fetch_role(941817354734686239)
  80.  
  81. authRole = await guild.fetch_role(1106563044248657971)
  82.  
  83. await ctx.send("You are verified with Orosius Authorization.", ephemeral=True)
  84.  
  85. if roleCheck == False:
  86. await ctx.author.add_role(authRole)
  87.  
  88. if unroleCheck == True:
  89. await ctx.author.remove_role(unauthRole)
  90.  
  91. if testSub == False:
  92. await ctx.author.add_role(testSubRole)
  93.  
  94.  
  95. def setup(client):
  96. VerifyButton(client)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement