Skip to content

Commit

Permalink
Additional logs
Browse files Browse the repository at this point in the history
  • Loading branch information
karntrehan committed Sep 26, 2024
1 parent a33da3f commit 7afbc56
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ def __init__(
super().__init__(title=title, timeout=timeout, custom_id=custom_id)

async def post_data(self, table_name, data):
print("PostData: "+table_name)
print("PostData: "+data)
url = f"{os.getenv('SUPABASE_URL')}/rest/v1/{table_name}",
print("PostData: "+url)
headers = {
"apikey": f"{os.getenv('SUPABASE_KEY')}",
"Authorization": f"Bearer {os.getenv('SUPABASE_KEY')}",
Expand Down Expand Up @@ -71,20 +74,20 @@ async def post_data(self, table_name, data):
)

async def on_submit(self, interaction: discord.Interaction):
print("On_Submit")
user = interaction.user
supaClient = SupabaseClient()
await interaction.response.send_message(
"Thanks! Now please sign in via Github!",
view=AuthenticationView(user.id),
ephemeral=True,
)
await self.post_data("contributors_discord",
{
"name": self.name.value,
"discord_id": user.id,
"country": self.country.value
}
)
user_data = {
"name": self.name.value,
"discord_id": user.id,
"country": self.country.value
}
await self.post_data("contributors_discord", user_data)

verifiedContributorRoleID = 1247854311191351307
print("User:", type(user))
Expand All @@ -94,13 +97,13 @@ async def on_submit(self, interaction: discord.Interaction):
else:
async def hasIntroduced():
print("Checking hasIntroduced...")
try:
print("Trying has authenticated")
#authentication = supaClient.read(
# "contributors_registration", "discord_id", user.id
#)
except Exception as e:
print("Failed hasIntroduced: "+e)
# try:
# print("Trying has authenticated")
# authentication = supaClient.read(
# "contributors_registration", "discord_id", user.id
# )
# except Exception as e:
# print("Failed hasIntroduced: "+e)
authentication = False
print("Authentication: "+authentication)
while not authentication:
Expand Down

0 comments on commit 7afbc56

Please sign in to comment.