update for nixos
This commit is contained in:
25
bot.py
25
bot.py
@ -9,7 +9,7 @@ import asyncio
|
|||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
from discord import Intents
|
# from discord import Intents
|
||||||
|
|
||||||
from scraper import Girls
|
from scraper import Girls
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ GUILD = os.getenv("DISCORD_GUILD") # Zocken mit Heidi
|
|||||||
class HeidiClient(discord.Client):
|
class HeidiClient(discord.Client):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
intents=Intents.default(),
|
# intents=Intents.default(),
|
||||||
status="Nur eine kann Germany's next Topmodel werden!",
|
status="Nur eine kann Germany's next Topmodel werden!",
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -50,6 +50,7 @@ class HeidiClient(discord.Client):
|
|||||||
### Voicelines
|
### Voicelines
|
||||||
|
|
||||||
self.matchers["sag kein Foto$"] = self.say_kein_foto
|
self.matchers["sag kein Foto$"] = self.say_kein_foto
|
||||||
|
self.matchers["sag Opfer"] = self.say_opfer
|
||||||
|
|
||||||
### Helpers ------------------------------------------------------------------------------------
|
### Helpers ------------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -208,7 +209,25 @@ class HeidiClient(discord.Client):
|
|||||||
voice_client.play(audio_source)
|
voice_client.play(audio_source)
|
||||||
|
|
||||||
while voice_client.is_playing():
|
while voice_client.is_playing():
|
||||||
asyncio.sleep(1)
|
await asyncio.sleep(1)
|
||||||
|
|
||||||
|
await voice_client.disconnect()
|
||||||
|
|
||||||
|
async def say_opfer(self, message):
|
||||||
|
"""
|
||||||
|
sag Opfer ("Opfer")
|
||||||
|
"""
|
||||||
|
voice_channel = message.author.voice.channel
|
||||||
|
|
||||||
|
if voice_channel == None:
|
||||||
|
return
|
||||||
|
|
||||||
|
voice_client = await voice_channel.connect()
|
||||||
|
audio_source = discord.FFmpegPCMAudio("sounds/opfer.mp3")
|
||||||
|
voice_client.play(audio_source)
|
||||||
|
|
||||||
|
while voice_client.is_playing():
|
||||||
|
await asyncio.sleep(1)
|
||||||
|
|
||||||
await voice_client.disconnect()
|
await voice_client.disconnect()
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ class Girls():
|
|||||||
|
|
||||||
self.girls_in = {girl.find("h4", class_="candidate-title").text.lower(): girl for girl in girls_in}
|
self.girls_in = {girl.find("h4", class_="candidate-title").text.lower(): girl for girl in girls_in}
|
||||||
self.girls_out = {girl.find("h4", class_="candidate-title").text.lower(): girl for girl in girls_out}
|
self.girls_out = {girl.find("h4", class_="candidate-title").text.lower(): girl for girl in girls_out}
|
||||||
self.girls = self.girls_in | self.girls_out
|
self.girls = {**self.girls_in, **self.girls_out}
|
||||||
|
|
||||||
|
|
||||||
def get_in_names(self):
|
def get_in_names(self):
|
||||||
|
22
shell.nix
Normal file
22
shell.nix
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{ pkgs ? import <nixpkgs> {} }:
|
||||||
|
|
||||||
|
with pkgs;
|
||||||
|
|
||||||
|
let myPython = python38.buildEnv.override {
|
||||||
|
extraLibs = with python38Packages; [
|
||||||
|
python-dotenv
|
||||||
|
rich
|
||||||
|
discordpy
|
||||||
|
beautifulsoup4
|
||||||
|
selenium
|
||||||
|
];
|
||||||
|
};
|
||||||
|
in
|
||||||
|
|
||||||
|
mkShell {
|
||||||
|
buildInputs = [
|
||||||
|
myPython
|
||||||
|
nodePackages.pyright
|
||||||
|
geckodriver
|
||||||
|
];
|
||||||
|
}
|
Reference in New Issue
Block a user