Skip to content

Commit

Permalink
send userID to Ha webhook for vcnotifs
Browse files Browse the repository at this point in the history
  • Loading branch information
mralext20 committed May 4, 2024
1 parent 67666f6 commit 5281f4b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions alexBot/cogs/smartHome.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ async def on_voice_state_update(
if before.deaf != after.deaf:
message += f"you were {'' if after.deaf else 'un'}server deafened\n"
# if before.self_video != after.self_video:
# message += f"you {'' if after.self_video else 'un'}started video\n"
# message += f"you {'started' if after.self_video else 'ended'} video\n"
# if before.self_stream != after.self_stream:
# message += f"you {'' if after.self_stream else 'un'}started streaming\n"
# message += f"you {'started' if after.self_stream else 'ended'} streaming\n"
log.debug(f"message: {message}")

if message == "":
Expand All @@ -188,7 +188,7 @@ async def on_voice_state_update(
message = None
memberList: List[discord.Member] = []
if not (targetMember := channel.guild.get_member(user)):
return # user not in server
return # user not in server
if after.channel and not after.channel.permissions_for(targetMember).view_channel:
after.channel = None
log.debug(f"checking {member.display_name} in {channel.guild.name} ({channel.guild.id})")
Expand Down Expand Up @@ -240,7 +240,7 @@ async def on_voice_state_update(

after.channel = oldAfter

async def send_notification(self, user: int, title: str, members: List[discord.Member]):
async def send_notification(self, user_id: int, title: str, members: List[discord.Member]):
log.debug(f"title: {title}")
content = f"Current members in your channel are:\n{NEWLINE.join([f'{m.display_name} {render_voiceState(m)}' for m in members])}"

Expand All @@ -253,7 +253,8 @@ async def send_notification(self, user: int, title: str, members: List[discord.M
json={
"content": content,
"title": title,
"target_device": USER_TO_HA_DEVICE[user],
"target_device": USER_TO_HA_DEVICE[user_id], # legacy, remove soon
"discord_id": user_id,
"channel": "vcNotifs",
"group": "vcNotifs",
},
Expand Down

0 comments on commit 5281f4b

Please sign in to comment.