Compare commits
3 Commits
0f6cc12182
...
d7c3a7c740
| Author | SHA1 | Date | |
|---|---|---|---|
| d7c3a7c740 | |||
| bdcd5208a7 | |||
| 79fcf0142a |
@ -1,2 +0,0 @@
|
|||||||
[ENTRANCE.SOUND]
|
|
||||||
|
|
||||||
19
bot.py
19
bot.py
@ -120,9 +120,9 @@ def user_entrance_sound_autocomplete(
|
|||||||
"""
|
"""
|
||||||
boards: List[str] = os.listdir(SOUNDDIR)
|
boards: List[str] = os.listdir(SOUNDDIR)
|
||||||
all_sounds: Dict[str, List[str]] = {
|
all_sounds: Dict[str, List[str]] = {
|
||||||
board: list(map(lambda x: x.split(".")[0], os.listdir(f"{SOUNDDIR}/{board}/")))
|
board: os.listdir(f"{SOUNDDIR}/{board}/")
|
||||||
for board in boards
|
for board in boards
|
||||||
} # These are all sounds, organized per board
|
} # 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
|
# @todo Initially only suggest boards, because there are too many sounds to show them all
|
||||||
completions: List[Choice[str]] = []
|
completions: List[Choice[str]] = []
|
||||||
@ -133,7 +133,7 @@ def user_entrance_sound_autocomplete(
|
|||||||
for sound in board_sounds: # Iterate over board specific sounds
|
for sound in board_sounds: # Iterate over board specific sounds
|
||||||
soundpath = f"{board}/{sound}"
|
soundpath = f"{board}/{sound}"
|
||||||
if soundpath.lower().startswith(current.lower()):
|
if soundpath.lower().startswith(current.lower()):
|
||||||
completions += [Choice(name=soundpath, value=soundpath)]
|
completions += [Choice(name=soundpath.split(".")[0], value=soundpath)]
|
||||||
|
|
||||||
return completions
|
return completions
|
||||||
|
|
||||||
@ -188,6 +188,10 @@ async def heidi_exclaim(interaction: Interaction) -> None:
|
|||||||
"Warum denn so schüchtern?",
|
"Warum denn so schüchtern?",
|
||||||
"Im TV ist das legal!",
|
"Im TV ist das legal!",
|
||||||
"Das Stroh ist nur fürs Shooting!",
|
"Das Stroh ist nur fürs Shooting!",
|
||||||
|
"Jetzt sei doch mal sexy!",
|
||||||
|
"Stell dich nicht so an!",
|
||||||
|
"Models müssen da halt durch!",
|
||||||
|
"Heul doch nicht!"
|
||||||
]
|
]
|
||||||
await interaction.response.send_message(random.choice(messages))
|
await interaction.response.send_message(random.choice(messages))
|
||||||
|
|
||||||
@ -208,14 +212,13 @@ async def magic_shell(interaction: Interaction, question: str) -> None:
|
|||||||
"Klaro Karo",
|
"Klaro Karo",
|
||||||
"Offensichtlich Sherlock",
|
"Offensichtlich Sherlock",
|
||||||
"Tom sagt Ja",
|
"Tom sagt Ja",
|
||||||
|
|
||||||
"Nein!",
|
"Nein!",
|
||||||
"Nö.",
|
"Nö.",
|
||||||
"Nä.",
|
"Nä.",
|
||||||
"Niemals!",
|
"Niemals!",
|
||||||
"Nur über meine Leiche du Hurensohn!",
|
"Nur über meine Leiche du Hurensohn!",
|
||||||
"In deinen Träumen.",
|
"In deinen Träumen.",
|
||||||
"Tom sagt Nein"
|
"Tom sagt Nein",
|
||||||
]
|
]
|
||||||
question = question.strip()
|
question = question.strip()
|
||||||
question_mark = "" if question[-1] == "?" else "?"
|
question_mark = "" if question[-1] == "?" else "?"
|
||||||
@ -265,12 +268,10 @@ async def sound_autocomplete(
|
|||||||
Suggest a sound from an already selected board.
|
Suggest a sound from an already selected board.
|
||||||
"""
|
"""
|
||||||
board: str = interaction.namespace.board
|
board: str = interaction.namespace.board
|
||||||
sounds: List[str] = list(
|
sounds: List[str] = os.listdir(f"{SOUNDDIR}/{board}/")
|
||||||
map(lambda x: x.split(".")[0], os.listdir(f"{SOUNDDIR}/{board}/"))
|
|
||||||
)
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
Choice(name=sound, value=sound)
|
Choice(name=sound.split(".")[0], value=sound)
|
||||||
for sound in sounds
|
for sound in sounds
|
||||||
if sound.lower().startswith(current.lower())
|
if sound.lower().startswith(current.lower())
|
||||||
]
|
]
|
||||||
|
|||||||
@ -19,9 +19,9 @@ async def play_voice_line(
|
|||||||
Play a voice line in the specified channel.
|
Play a voice line in the specified channel.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
open(f"{SOUNDDIR}/{board}/{sound}.mkv")
|
open(f"{SOUNDDIR}/{board}/{sound}")
|
||||||
except IOError:
|
except IOError:
|
||||||
print("Error: Invalid soundfile!")
|
print(f"Error: Invalid soundfile {SOUNDDIR}/{board}/{sound}!")
|
||||||
if interaction is not None:
|
if interaction is not None:
|
||||||
await interaction.response.send_message(
|
await interaction.response.send_message(
|
||||||
f'Heidi sagt: "{board}/{sound}" kanninich finden bruder'
|
f'Heidi sagt: "{board}/{sound}" kanninich finden bruder'
|
||||||
@ -32,7 +32,7 @@ async def play_voice_line(
|
|||||||
await interaction.response.send_message(f'Heidi sagt: "{board}/{sound}"')
|
await interaction.response.send_message(f'Heidi sagt: "{board}/{sound}"')
|
||||||
|
|
||||||
audio_source = discord.FFmpegPCMAudio(
|
audio_source = discord.FFmpegPCMAudio(
|
||||||
f"{SOUNDDIR}/{board}/{sound}.mkv"
|
f"{SOUNDDIR}/{board}/{sound}"
|
||||||
) # only works from docker
|
) # only works from docker
|
||||||
voice_client = await voice_channel.connect()
|
voice_client = await voice_channel.connect()
|
||||||
voice_client.play(audio_source)
|
voice_client.play(audio_source)
|
||||||
|
|||||||
Reference in New Issue
Block a user