Compare commits
No commits in common. "5faf0b9487720fc4e7e1a9ea623d10220e47c4a9" and "b1bcb44dac6af1328167d46258e9d7ca7837381a" have entirely different histories.
5faf0b9487
...
b1bcb44dac
3 changed files with 2 additions and 52 deletions
22
Dockerfile
22
Dockerfile
|
@ -1,22 +0,0 @@
|
||||||
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
ENV UV_COMPILE_BYTECODE=1
|
|
||||||
ENV UV_LINK_MODE=copy
|
|
||||||
|
|
||||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
||||||
--mount=type=bind,source=uv.lock,target=uv.lock \
|
|
||||||
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
|
|
||||||
uv sync --frozen --no-install-project --no-dev
|
|
||||||
|
|
||||||
ADD . /app
|
|
||||||
|
|
||||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
||||||
uv sync --frozen --no-dev
|
|
||||||
|
|
||||||
ENV PATH="/app/.venv/bin:$PATH"
|
|
||||||
|
|
||||||
ENTRYPOINT []
|
|
||||||
|
|
||||||
CMD ["uv", "run", "python", "-m", "botbotbot"]
|
|
|
@ -42,14 +42,6 @@ class VoiceBot:
|
||||||
guild_ids=self.guild_ids,
|
guild_ids=self.guild_ids,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
self.bot.add_application_command(
|
|
||||||
discord.SlashCommand(
|
|
||||||
self.unjoin_voice,
|
|
||||||
name="unjoin",
|
|
||||||
description="Déconnecter du channel vocal",
|
|
||||||
guild_ids=self.guild_ids,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
async def random_connect(self) -> None:
|
async def random_connect(self) -> None:
|
||||||
while True:
|
while True:
|
||||||
|
@ -139,16 +131,11 @@ class VoiceBot:
|
||||||
await self.disconnect_voice(channel.guild)
|
await self.disconnect_voice(channel.guild)
|
||||||
if vo is None or vo.channel != channel:
|
if vo is None or vo.channel != channel:
|
||||||
vo = await channel.connect()
|
vo = await channel.connect()
|
||||||
self.vo[channel.guild.id] = vo
|
self.vo[channel.guild.id] = vo
|
||||||
return vo
|
return vo
|
||||||
|
|
||||||
async def disconnect_voice(self, guild: discord.Guild) -> None:
|
async def disconnect_voice(self, guild: discord.Guild) -> None:
|
||||||
if vo := self.vo.pop(guild.id, None):
|
if vo := self.vo.pop(guild.id, None):
|
||||||
if self.cambai is not None:
|
|
||||||
source = await discord.FFmpegOpusAudio.from_probe(
|
|
||||||
self.cambai.tts("À plus les jeunes !")
|
|
||||||
)
|
|
||||||
await vo.play(source, wait_finish=True)
|
|
||||||
await vo.disconnect()
|
await vo.disconnect()
|
||||||
|
|
||||||
async def join_voice(self, ctx: discord.ApplicationContext) -> None:
|
async def join_voice(self, ctx: discord.ApplicationContext) -> None:
|
||||||
|
@ -166,21 +153,6 @@ class VoiceBot:
|
||||||
delete_after=30,
|
delete_after=30,
|
||||||
)
|
)
|
||||||
|
|
||||||
async def unjoin_voice(self, ctx: discord.ApplicationContext) -> None:
|
|
||||||
if ctx.user.voice:
|
|
||||||
await ctx.respond(
|
|
||||||
f"Disconnecting from voice channel {ctx.user.voice.channel}.",
|
|
||||||
ephemeral=True,
|
|
||||||
delete_after=30,
|
|
||||||
)
|
|
||||||
await self.disconnect_voice(ctx.user.voice.channel.guild)
|
|
||||||
else:
|
|
||||||
await ctx.respond(
|
|
||||||
"You are not connected to a voice channel.",
|
|
||||||
ephemeral=True,
|
|
||||||
delete_after=30,
|
|
||||||
)
|
|
||||||
|
|
||||||
async def on_voice_state_update(
|
async def on_voice_state_update(
|
||||||
self,
|
self,
|
||||||
member: discord.Member,
|
member: discord.Member,
|
||||||
|
|
|
@ -14,7 +14,7 @@ dependencies = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.scripts]
|
[project.scripts]
|
||||||
botbotbot = "botbotbot:main"
|
hasspy = "botbotbot:main"
|
||||||
|
|
||||||
[dependency-groups]
|
[dependency-groups]
|
||||||
dev = [
|
dev = [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue