diff --git a/bot.py b/bot.py index 684bfea..b724252 100644 --- a/bot.py +++ b/bot.py @@ -4,6 +4,7 @@ import os import re import random import datetime +import asyncio from dotenv import load_dotenv @@ -46,6 +47,10 @@ class HeidiClient(discord.Client): self.matchers["gib Link"] = self.show_link self.matchers["welche Farbe .+\\?$"] = self.random_color + ### Voicelines + + self.matchers["sag kein Foto$"] = self.say_kein_foto + ### Helpers ------------------------------------------------------------------------------------ def _help_text(self): @@ -187,6 +192,26 @@ class HeidiClient(discord.Client): choices = ["Rot", "Grün", "Gelb", "Blau", "Lila", "Pink", "Türkis", "Schwarz", "Weiß", "Grau", "Gelb", "Orange", "Olivegrün", "Mitternachtsblau", "Braun", "Tobe"] await message.channel.send(random.choice(choices)) + ### Voiceboard --------------------------------------------------------------------------------- + + async def say_kein_foto(self, message): + """ + sag kein Foto ("Ich habe heute leider kein Foto für dich") + """ + voice_channel = message.author.voice.channel + + if voice_channel == None: + return + + voice_client = await voice_channel.connect() + audio_source = discord.FFmpegPCMAudio("sounds/kein_foto.mp3") + voice_client.play(audio_source) + + while voice_client.is_playing(): + asyncio.sleep(1) + + await voice_client.disconnect() + ### Automatic Actions -------------------------------------------------------------------------- async def autoreact_to_girls(self, message): diff --git a/sounds/kein_foto.mp3 b/sounds/kein_foto.mp3 new file mode 100644 index 0000000..31fe045 Binary files /dev/null and b/sounds/kein_foto.mp3 differ