add first voice line
This commit is contained in:
25
bot.py
25
bot.py
@ -4,6 +4,7 @@ import os
|
|||||||
import re
|
import re
|
||||||
import random
|
import random
|
||||||
import datetime
|
import datetime
|
||||||
|
import asyncio
|
||||||
|
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
@ -46,6 +47,10 @@ class HeidiClient(discord.Client):
|
|||||||
self.matchers["gib Link"] = self.show_link
|
self.matchers["gib Link"] = self.show_link
|
||||||
self.matchers["welche Farbe .+\\?$"] = self.random_color
|
self.matchers["welche Farbe .+\\?$"] = self.random_color
|
||||||
|
|
||||||
|
### Voicelines
|
||||||
|
|
||||||
|
self.matchers["sag kein Foto$"] = self.say_kein_foto
|
||||||
|
|
||||||
### Helpers ------------------------------------------------------------------------------------
|
### Helpers ------------------------------------------------------------------------------------
|
||||||
|
|
||||||
def _help_text(self):
|
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"]
|
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))
|
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 --------------------------------------------------------------------------
|
### Automatic Actions --------------------------------------------------------------------------
|
||||||
|
|
||||||
async def autoreact_to_girls(self, message):
|
async def autoreact_to_girls(self, message):
|
||||||
|
BIN
sounds/kein_foto.mp3
Normal file
BIN
sounds/kein_foto.mp3
Normal file
Binary file not shown.
Reference in New Issue
Block a user