Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import interactions
- from interactions import listen, Extension, events, Guild, Embed, Button, ButtonStyle, StringSelectMenu, component_callback, ComponentContext
- from interactions import StringSelectOption
- from interactions.api.events import Component
- from resources.firebase import firebaseLib
- from resources.verify_methods.rover import RoVer
- from resources.verify_methods.bloxlink import Bloxlink
- from resources.role import PermissionCog
- class VerifyButton(Extension):
- def __init__(self, client: interactions.Client):
- self.client = client
- self.selection = StringSelectMenu(
- StringSelectOption(
- label="Roblox OAuth",
- value= "Roblox OAuth",
- description="Verify your Roblox Account with Roblox OAuth",
- # emoji=self.client.get_custom_emoji(1137546094486765598)
- ),
- StringSelectOption(
- label="Bloxlink",
- value= "Bloxlink",
- description="Verify your Roblox Account with Bloxlink",
- # emoji=self.client.get_custom_emoji(1137545583331115090)
- ),
- custom_id="verify_select",
- placeholder="Choose Verification Method",
- min_values=1,
- max_values=1,
- )
- # @listen()
- # async def on_ready(self):
- # 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.")
- # 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.")
- # channel = await self.client.fetch_channel(1090735315376947231)
- # await channel.send(embeds=embed, components=self.selection)
- @component_callback("verify_select")
- async def my_callback(self, ctx: ComponentContext):
- await ctx.defer(ephemeral=True)
- options = ctx.values
- selectedOption = options[0]
- success, error = None, None
- print(selectedOption)
- if selectedOption == "Roblox OAuth":
- userInfo = firebaseLib().fetch_roblox_id_from_discord_id(ctx.author.id)
- if userInfo != None:
- return await ctx.send("You are not verified with Orosius Authorization. Please verify @ https://verify.orosiuslabs.com/", ephemeral=True)
- elif selectedOption == "Bloxlink":
- userInfo = firebaseLib().fetch_roblox_id_from_discord_id(ctx.author.id)
- if userInfo != None:
- return await ctx.send("You already verified with Orosius Authorization.", ephemeral=True)
- success, error = await Bloxlink().get_roblox_info(ctx.author.id)
- if success == True:
- guild = await self.client.fetch_guild(864557936068395018)
- authRole = await guild.fetch_role(1091834304776130581)
- roleCheck = await PermissionCog().check_role(ctx.author, 1091834304776130581)
- unroleCheck = await PermissionCog().check_role(ctx.author, 1106563044248657971)
- testSub = await PermissionCog().check_role(ctx.author, 941817354734686239)
- testSubRole = await guild.fetch_role(941817354734686239)
- authRole = await guild.fetch_role(1106563044248657971)
- await ctx.send("You are verified with Orosius Authorization.", ephemeral=True)
- if roleCheck == False:
- await ctx.author.add_role(authRole)
- if unroleCheck == True:
- await ctx.author.remove_role(unauthRole)
- if testSub == False:
- await ctx.author.add_role(testSubRole)
- def setup(client):
- VerifyButton(client)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement