Only play entrance sound when other is present + reformat
All checks were successful
Build Heidi Docker image / build-docker (push) Successful in 14s
All checks were successful
Build Heidi Docker image / build-docker (push) Successful in 14s
This commit is contained in:
5
bot.py
5
bot.py
@ -120,8 +120,7 @@ def user_entrance_sound_autocomplete(
|
||||
"""
|
||||
boards: List[str] = os.listdir(SOUNDDIR)
|
||||
all_sounds: Dict[str, List[str]] = {
|
||||
board: os.listdir(f"{SOUNDDIR}/{board}/")
|
||||
for board in boards
|
||||
board: os.listdir(f"{SOUNDDIR}/{board}/") for board in boards
|
||||
} # These are all sounds, organized per board, without file extension
|
||||
|
||||
# @todo Initially only suggest boards, because there are too many sounds to show them all
|
||||
@ -191,7 +190,7 @@ async def heidi_exclaim(interaction: Interaction) -> None:
|
||||
"Jetzt sei doch mal sexy!",
|
||||
"Stell dich nicht so an!",
|
||||
"Models müssen da halt durch!",
|
||||
"Heul doch nicht!"
|
||||
"Heul doch nicht!",
|
||||
]
|
||||
await interaction.response.send_message(random.choice(messages))
|
||||
|
||||
|
@ -115,9 +115,20 @@ class HeidiClient(discord.Client):
|
||||
after: VoiceState,
|
||||
) -> None:
|
||||
"""
|
||||
Play a sound when a member joins a voice channel.
|
||||
Play a sound when a member joins a voice channel (and another member is present).
|
||||
This function is set in on_voice_state_triggers and triggered by the on_voice_state_update event.
|
||||
"""
|
||||
|
||||
# Don't play anything when no other users are present
|
||||
if (
|
||||
member is not None
|
||||
and member.voice is not None
|
||||
and member.voice.channel is not None
|
||||
and len(member.voice.channel.members) <= 1
|
||||
):
|
||||
print("Not playing entrance sound, as no other members are present")
|
||||
return
|
||||
|
||||
soundpath: Union[str, None] = self.user_config["ENTRANCE.SOUND"].get(
|
||||
member.name, None
|
||||
)
|
||||
|
@ -8,6 +8,7 @@ from heidi_constants import *
|
||||
|
||||
print("Debug: Importing heidi_helpers.py")
|
||||
|
||||
|
||||
# @todo Normalize volume when playing
|
||||
async def play_voice_line(
|
||||
interaction: Union[Interaction, None],
|
||||
|
Reference in New Issue
Block a user