refactor(commands/voice): split into separate files
This commit is contained in:
parent
2ea3d74e8a
commit
8ee5d01bf6
19
commands/voice/__init__.py
Normal file
19
commands/voice/__init__.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
from .channel import join, leave
|
||||||
|
from .playback import fast_forward, pause, resume, volume
|
||||||
|
from .playing import playing
|
||||||
|
from .queue import queue_or_play, skip
|
||||||
|
from .utils import remove_queued
|
||||||
|
|
||||||
|
__all__ = [
|
||||||
|
"join",
|
||||||
|
"leave",
|
||||||
|
"fast_forward",
|
||||||
|
"playing",
|
||||||
|
"queue_or_play",
|
||||||
|
"skip",
|
||||||
|
"resume",
|
||||||
|
"pause",
|
||||||
|
"skip",
|
||||||
|
"remove_queued",
|
||||||
|
"volume",
|
||||||
|
]
|
19
commands/voice/channel.py
Normal file
19
commands/voice/channel.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import utils
|
||||||
|
|
||||||
|
from .utils import command_allowed
|
||||||
|
|
||||||
|
|
||||||
|
async def join(message):
|
||||||
|
if message.guild.voice_client:
|
||||||
|
return await message.guild.voice_client.move_to(message.channel)
|
||||||
|
|
||||||
|
await message.channel.connect()
|
||||||
|
await utils.add_check_reaction(message)
|
||||||
|
|
||||||
|
|
||||||
|
async def leave(message):
|
||||||
|
if not command_allowed(message):
|
||||||
|
return
|
||||||
|
|
||||||
|
await message.guild.voice_client.disconnect()
|
||||||
|
await utils.add_check_reaction(message)
|
90
commands/voice/playback.py
Normal file
90
commands/voice/playback.py
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
import arguments
|
||||||
|
import commands
|
||||||
|
import utils
|
||||||
|
|
||||||
|
from .utils import command_allowed
|
||||||
|
|
||||||
|
|
||||||
|
async def resume(message):
|
||||||
|
if not command_allowed(message):
|
||||||
|
return
|
||||||
|
|
||||||
|
if message.guild.voice_client.is_paused():
|
||||||
|
message.guild.voice_client.resume()
|
||||||
|
await utils.add_check_reaction(message)
|
||||||
|
else:
|
||||||
|
await utils.reply(
|
||||||
|
message,
|
||||||
|
"nothing is paused!",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
async def pause(message):
|
||||||
|
if not command_allowed(message):
|
||||||
|
return
|
||||||
|
|
||||||
|
if message.guild.voice_client.is_playing():
|
||||||
|
message.guild.voice_client.pause()
|
||||||
|
await utils.add_check_reaction(message)
|
||||||
|
else:
|
||||||
|
await utils.reply(
|
||||||
|
message,
|
||||||
|
"nothing is playing!",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
async def fast_forward(message):
|
||||||
|
tokens = commands.tokenize(message.content)
|
||||||
|
parser = arguments.ArgumentParser(tokens[0], "fast forward audio playback")
|
||||||
|
parser.add_argument(
|
||||||
|
"seconds",
|
||||||
|
type=lambda v: arguments.range_type(v, min=0, max=300),
|
||||||
|
help="the amount of seconds to fast forward",
|
||||||
|
)
|
||||||
|
if not (args := await parser.parse_args(message, tokens)):
|
||||||
|
return
|
||||||
|
|
||||||
|
if not command_allowed(message):
|
||||||
|
return
|
||||||
|
|
||||||
|
if not message.guild.voice_client.source:
|
||||||
|
await utils.reply(message, "nothing is playing!")
|
||||||
|
return
|
||||||
|
|
||||||
|
message.guild.voice_client.pause()
|
||||||
|
message.guild.voice_client.source.original.fast_forward(args.seconds)
|
||||||
|
message.guild.voice_client.resume()
|
||||||
|
|
||||||
|
await utils.add_check_reaction(message)
|
||||||
|
|
||||||
|
|
||||||
|
async def volume(message):
|
||||||
|
tokens = commands.tokenize(message.content)
|
||||||
|
parser = arguments.ArgumentParser(tokens[0], "get or set the current volume level")
|
||||||
|
parser.add_argument(
|
||||||
|
"volume",
|
||||||
|
nargs="?",
|
||||||
|
type=lambda v: arguments.range_type(v, min=0, max=150),
|
||||||
|
help="the volume level (0 - 150)",
|
||||||
|
)
|
||||||
|
if not (args := await parser.parse_args(message, tokens)):
|
||||||
|
return
|
||||||
|
|
||||||
|
if not command_allowed(message, immutable=True):
|
||||||
|
return
|
||||||
|
|
||||||
|
if not message.guild.voice_client.source:
|
||||||
|
await utils.reply(message, "nothing is playing!")
|
||||||
|
return
|
||||||
|
|
||||||
|
if args.volume is None:
|
||||||
|
await utils.reply(
|
||||||
|
message,
|
||||||
|
f"{int(message.guild.voice_client.source.volume * 100)}",
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
if not command_allowed(message):
|
||||||
|
return
|
||||||
|
|
||||||
|
message.guild.voice_client.source.volume = float(args.volume) / 100.0
|
||||||
|
await utils.add_check_reaction(message)
|
75
commands/voice/playing.py
Normal file
75
commands/voice/playing.py
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
import disnake
|
||||||
|
import disnake_paginator
|
||||||
|
|
||||||
|
import arguments
|
||||||
|
import commands
|
||||||
|
import constants
|
||||||
|
import utils
|
||||||
|
import youtubedl
|
||||||
|
from state import players
|
||||||
|
|
||||||
|
from .utils import command_allowed
|
||||||
|
|
||||||
|
|
||||||
|
async def playing(message):
|
||||||
|
tokens = commands.tokenize(message.content)
|
||||||
|
parser = arguments.ArgumentParser(
|
||||||
|
tokens[0], "get information about the currently playing song"
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"-d",
|
||||||
|
"--description",
|
||||||
|
action="store_true",
|
||||||
|
help="get the description",
|
||||||
|
)
|
||||||
|
if not (args := await parser.parse_args(message, tokens)):
|
||||||
|
return
|
||||||
|
|
||||||
|
if not command_allowed(message, immutable=True):
|
||||||
|
return
|
||||||
|
|
||||||
|
if source := message.guild.voice_client.source:
|
||||||
|
if args.description:
|
||||||
|
if description := source.description:
|
||||||
|
paginator = disnake_paginator.ButtonPaginator(
|
||||||
|
invalid_user_function=utils.invalid_user_handler,
|
||||||
|
color=constants.EMBED_COLOR,
|
||||||
|
title=source.title,
|
||||||
|
segments=disnake_paginator.split(description),
|
||||||
|
)
|
||||||
|
for embed in paginator.embeds:
|
||||||
|
embed.url = source.original_url
|
||||||
|
await paginator.start(utils.MessageInteractionWrapper(message))
|
||||||
|
else:
|
||||||
|
await utils.reply(
|
||||||
|
message,
|
||||||
|
source.description or "no description found!",
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
|
progress = source.original.progress / source.duration
|
||||||
|
embed = disnake.Embed(
|
||||||
|
color=constants.EMBED_COLOR,
|
||||||
|
title=source.title,
|
||||||
|
url=source.original_url,
|
||||||
|
description=f"{'⏸️ ' if message.guild.voice_client.is_paused() else ''}"
|
||||||
|
f"`[{'#'*int(progress * constants.BAR_LENGTH)}{'-'*int((1 - progress) * constants.BAR_LENGTH)}]` "
|
||||||
|
f"**{youtubedl.format_duration(int(source.original.progress))}** / **{youtubedl.format_duration(source.duration)}** (**{round(progress * 100)}%**)",
|
||||||
|
)
|
||||||
|
embed.add_field(name="Volume", value=f"{int(source.volume*100)}%")
|
||||||
|
embed.add_field(name="Views", value=f"{source.view_count:,}")
|
||||||
|
embed.add_field(
|
||||||
|
name="Queuer",
|
||||||
|
value=players[message.guild.id].current.trigger_message.author.mention,
|
||||||
|
)
|
||||||
|
embed.set_image(source.thumbnail_url)
|
||||||
|
|
||||||
|
await utils.reply(
|
||||||
|
message,
|
||||||
|
embed=embed,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
await utils.reply(
|
||||||
|
message,
|
||||||
|
"nothing is playing!",
|
||||||
|
)
|
@ -10,6 +10,9 @@ import utils
|
|||||||
import youtubedl
|
import youtubedl
|
||||||
from state import client, players
|
from state import client, players
|
||||||
|
|
||||||
|
from .playback import resume
|
||||||
|
from .utils import command_allowed, ensure_joined, play_next
|
||||||
|
|
||||||
|
|
||||||
async def queue_or_play(message, edited=False):
|
async def queue_or_play(message, edited=False):
|
||||||
if message.guild.id not in players:
|
if message.guild.id not in players:
|
||||||
@ -227,95 +230,6 @@ async def queue_or_play(message, edited=False):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def playing(message):
|
|
||||||
tokens = commands.tokenize(message.content)
|
|
||||||
parser = arguments.ArgumentParser(
|
|
||||||
tokens[0], "get information about the currently playing song"
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
|
||||||
"-d",
|
|
||||||
"--description",
|
|
||||||
action="store_true",
|
|
||||||
help="get the description",
|
|
||||||
)
|
|
||||||
if not (args := await parser.parse_args(message, tokens)):
|
|
||||||
return
|
|
||||||
|
|
||||||
if not command_allowed(message, immutable=True):
|
|
||||||
return
|
|
||||||
|
|
||||||
if source := message.guild.voice_client.source:
|
|
||||||
if args.description:
|
|
||||||
if description := source.description:
|
|
||||||
paginator = disnake_paginator.ButtonPaginator(
|
|
||||||
invalid_user_function=utils.invalid_user_handler,
|
|
||||||
color=constants.EMBED_COLOR,
|
|
||||||
title=source.title,
|
|
||||||
segments=disnake_paginator.split(description),
|
|
||||||
)
|
|
||||||
for embed in paginator.embeds:
|
|
||||||
embed.url = source.original_url
|
|
||||||
await paginator.start(utils.MessageInteractionWrapper(message))
|
|
||||||
else:
|
|
||||||
await utils.reply(
|
|
||||||
message,
|
|
||||||
source.description or "no description found!",
|
|
||||||
)
|
|
||||||
return
|
|
||||||
|
|
||||||
progress = source.original.progress / source.duration
|
|
||||||
embed = disnake.Embed(
|
|
||||||
color=constants.EMBED_COLOR,
|
|
||||||
title=source.title,
|
|
||||||
url=source.original_url,
|
|
||||||
description=f"{'⏸️ ' if message.guild.voice_client.is_paused() else ''}"
|
|
||||||
f"`[{'#'*int(progress * constants.BAR_LENGTH)}{'-'*int((1 - progress) * constants.BAR_LENGTH)}]` "
|
|
||||||
f"**{youtubedl.format_duration(int(source.original.progress))}** / **{youtubedl.format_duration(source.duration)}** (**{round(progress * 100)}%**)",
|
|
||||||
)
|
|
||||||
embed.add_field(name="Volume", value=f"{int(source.volume*100)}%")
|
|
||||||
embed.add_field(name="Views", value=f"{source.view_count:,}")
|
|
||||||
embed.add_field(
|
|
||||||
name="Queuer",
|
|
||||||
value=players[message.guild.id].current.trigger_message.author.mention,
|
|
||||||
)
|
|
||||||
embed.set_image(source.thumbnail_url)
|
|
||||||
|
|
||||||
await utils.reply(
|
|
||||||
message,
|
|
||||||
embed=embed,
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
await utils.reply(
|
|
||||||
message,
|
|
||||||
"nothing is playing!",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
async def fast_forward(message):
|
|
||||||
tokens = commands.tokenize(message.content)
|
|
||||||
parser = arguments.ArgumentParser(tokens[0], "fast forward audio playback")
|
|
||||||
parser.add_argument(
|
|
||||||
"seconds",
|
|
||||||
type=lambda v: arguments.range_type(v, min=0, max=300),
|
|
||||||
help="the amount of seconds to fast forward",
|
|
||||||
)
|
|
||||||
if not (args := await parser.parse_args(message, tokens)):
|
|
||||||
return
|
|
||||||
|
|
||||||
if not command_allowed(message):
|
|
||||||
return
|
|
||||||
|
|
||||||
if not message.guild.voice_client.source:
|
|
||||||
await utils.reply(message, "nothing is playing!")
|
|
||||||
return
|
|
||||||
|
|
||||||
message.guild.voice_client.pause()
|
|
||||||
message.guild.voice_client.source.original.fast_forward(args.seconds)
|
|
||||||
message.guild.voice_client.resume()
|
|
||||||
|
|
||||||
await utils.add_check_reaction(message)
|
|
||||||
|
|
||||||
|
|
||||||
async def skip(message):
|
async def skip(message):
|
||||||
tokens = commands.tokenize(message.content)
|
tokens = commands.tokenize(message.content)
|
||||||
parser = arguments.ArgumentParser(tokens[0], "skip the currently playing song")
|
parser = arguments.ArgumentParser(tokens[0], "skip the currently playing song")
|
||||||
@ -345,158 +259,3 @@ async def skip(message):
|
|||||||
await utils.add_check_reaction(message)
|
await utils.add_check_reaction(message)
|
||||||
if not message.guild.voice_client.source:
|
if not message.guild.voice_client.source:
|
||||||
play_next(message)
|
play_next(message)
|
||||||
|
|
||||||
|
|
||||||
async def join(message):
|
|
||||||
if message.guild.voice_client:
|
|
||||||
return await message.guild.voice_client.move_to(message.channel)
|
|
||||||
|
|
||||||
await message.channel.connect()
|
|
||||||
await utils.add_check_reaction(message)
|
|
||||||
|
|
||||||
|
|
||||||
async def leave(message):
|
|
||||||
if not command_allowed(message):
|
|
||||||
return
|
|
||||||
|
|
||||||
await message.guild.voice_client.disconnect()
|
|
||||||
await utils.add_check_reaction(message)
|
|
||||||
|
|
||||||
|
|
||||||
async def resume(message):
|
|
||||||
if not command_allowed(message):
|
|
||||||
return
|
|
||||||
|
|
||||||
if message.guild.voice_client.is_paused():
|
|
||||||
message.guild.voice_client.resume()
|
|
||||||
await utils.add_check_reaction(message)
|
|
||||||
else:
|
|
||||||
await utils.reply(
|
|
||||||
message,
|
|
||||||
"nothing is paused!",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
async def pause(message):
|
|
||||||
if not command_allowed(message):
|
|
||||||
return
|
|
||||||
|
|
||||||
if message.guild.voice_client.is_playing():
|
|
||||||
message.guild.voice_client.pause()
|
|
||||||
await utils.add_check_reaction(message)
|
|
||||||
else:
|
|
||||||
await utils.reply(
|
|
||||||
message,
|
|
||||||
"nothing is playing!",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
async def volume(message):
|
|
||||||
tokens = commands.tokenize(message.content)
|
|
||||||
parser = arguments.ArgumentParser(tokens[0], "get or set the current volume level")
|
|
||||||
parser.add_argument(
|
|
||||||
"volume",
|
|
||||||
nargs="?",
|
|
||||||
type=lambda v: arguments.range_type(v, min=0, max=150),
|
|
||||||
help="the volume level (0 - 150)",
|
|
||||||
)
|
|
||||||
if not (args := await parser.parse_args(message, tokens)):
|
|
||||||
return
|
|
||||||
|
|
||||||
if not command_allowed(message, immutable=True):
|
|
||||||
return
|
|
||||||
|
|
||||||
if not message.guild.voice_client.source:
|
|
||||||
await utils.reply(message, "nothing is playing!")
|
|
||||||
return
|
|
||||||
|
|
||||||
if args.volume is None:
|
|
||||||
await utils.reply(
|
|
||||||
message,
|
|
||||||
f"{int(message.guild.voice_client.source.volume * 100)}",
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
if not command_allowed(message):
|
|
||||||
return
|
|
||||||
|
|
||||||
message.guild.voice_client.source.volume = float(args.volume) / 100.0
|
|
||||||
await utils.add_check_reaction(message)
|
|
||||||
|
|
||||||
|
|
||||||
def delete_queued(messages):
|
|
||||||
if messages[0].guild.id not in players:
|
|
||||||
return
|
|
||||||
|
|
||||||
if len(players[messages[0].guild.id].queue) == 0:
|
|
||||||
return
|
|
||||||
|
|
||||||
found = []
|
|
||||||
for message in messages:
|
|
||||||
for queued in players[message.guild.id].queue:
|
|
||||||
if queued.trigger_message.id == message.id:
|
|
||||||
found.append(queued)
|
|
||||||
for queued in found:
|
|
||||||
players[messages[0].guild.id].queue.remove(queued)
|
|
||||||
|
|
||||||
|
|
||||||
def play_after_callback(e, message, once):
|
|
||||||
if e:
|
|
||||||
print(f"player error: {e}")
|
|
||||||
if not once:
|
|
||||||
play_next(message)
|
|
||||||
|
|
||||||
|
|
||||||
def play_next(message, once=False, first=False):
|
|
||||||
if not message.guild.voice_client:
|
|
||||||
return
|
|
||||||
|
|
||||||
message.guild.voice_client.stop()
|
|
||||||
if message.guild.id in players and players[message.guild.id].queue:
|
|
||||||
queued = players[message.guild.id].queue_pop()
|
|
||||||
try:
|
|
||||||
message.guild.voice_client.play(
|
|
||||||
queued.player, after=lambda e: play_after_callback(e, message, once)
|
|
||||||
)
|
|
||||||
except disnake.opus.OpusNotLoaded:
|
|
||||||
utils.load_opus()
|
|
||||||
message.guild.voice_client.play(
|
|
||||||
queued.player, after=lambda e: play_after_callback(e, message, once)
|
|
||||||
)
|
|
||||||
|
|
||||||
embed = disnake.Embed(
|
|
||||||
color=constants.EMBED_COLOR,
|
|
||||||
title=queued.player.title,
|
|
||||||
url=queued.player.original_url,
|
|
||||||
description=f"`[{'-'*constants.BAR_LENGTH}]` **{youtubedl.format_duration(0)}** / **{youtubedl.format_duration(queued.player.duration)}**",
|
|
||||||
)
|
|
||||||
embed.add_field(name="Volume", value=f"{int(queued.player.volume*100)}%")
|
|
||||||
embed.add_field(name="Views", value=f"{queued.player.view_count:,}")
|
|
||||||
embed.add_field(
|
|
||||||
name="Queuer",
|
|
||||||
value=players[message.guild.id].current.trigger_message.author.mention,
|
|
||||||
)
|
|
||||||
embed.set_image(queued.player.thumbnail_url)
|
|
||||||
|
|
||||||
if first and len(players[message.guild.id].queue) == 0:
|
|
||||||
client.loop.create_task(utils.reply(message, embed=embed))
|
|
||||||
else:
|
|
||||||
client.loop.create_task(utils.channel_send(message, embed=embed))
|
|
||||||
|
|
||||||
|
|
||||||
async def ensure_joined(message):
|
|
||||||
if message.guild.voice_client is None:
|
|
||||||
if message.author.voice:
|
|
||||||
await message.author.voice.channel.connect()
|
|
||||||
else:
|
|
||||||
await utils.reply(message, "you are not connected to a voice channel!")
|
|
||||||
|
|
||||||
|
|
||||||
def command_allowed(message, immutable=False):
|
|
||||||
if not message.guild.voice_client:
|
|
||||||
return
|
|
||||||
if immutable:
|
|
||||||
return message.channel.id == message.guild.voice_client.channel.id
|
|
||||||
else:
|
|
||||||
if not message.author.voice:
|
|
||||||
return False
|
|
||||||
return message.author.voice.channel.id == message.guild.voice_client.channel.id
|
|
85
commands/voice/utils.py
Normal file
85
commands/voice/utils.py
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
import constants
|
||||||
|
import disnake
|
||||||
|
import youtubedl
|
||||||
|
from state import client, players
|
||||||
|
|
||||||
|
import utils
|
||||||
|
|
||||||
|
|
||||||
|
def play_after_callback(e, message, once):
|
||||||
|
if e:
|
||||||
|
print(f"player error: {e}")
|
||||||
|
if not once:
|
||||||
|
play_next(message)
|
||||||
|
|
||||||
|
|
||||||
|
def play_next(message, once=False, first=False):
|
||||||
|
if not message.guild.voice_client:
|
||||||
|
return
|
||||||
|
|
||||||
|
message.guild.voice_client.stop()
|
||||||
|
if message.guild.id in players and players[message.guild.id].queue:
|
||||||
|
queued = players[message.guild.id].queue_pop()
|
||||||
|
try:
|
||||||
|
message.guild.voice_client.play(
|
||||||
|
queued.player, after=lambda e: play_after_callback(e, message, once)
|
||||||
|
)
|
||||||
|
except disnake.opus.OpusNotLoaded:
|
||||||
|
utils.load_opus()
|
||||||
|
message.guild.voice_client.play(
|
||||||
|
queued.player, after=lambda e: play_after_callback(e, message, once)
|
||||||
|
)
|
||||||
|
|
||||||
|
embed = disnake.Embed(
|
||||||
|
color=constants.EMBED_COLOR,
|
||||||
|
title=queued.player.title,
|
||||||
|
url=queued.player.original_url,
|
||||||
|
description=f"`[{'-'*constants.BAR_LENGTH}]` **{youtubedl.format_duration(0)}** / **{youtubedl.format_duration(queued.player.duration)}**",
|
||||||
|
)
|
||||||
|
embed.add_field(name="Volume", value=f"{int(queued.player.volume*100)}%")
|
||||||
|
embed.add_field(name="Views", value=f"{queued.player.view_count:,}")
|
||||||
|
embed.add_field(
|
||||||
|
name="Queuer",
|
||||||
|
value=players[message.guild.id].current.trigger_message.author.mention,
|
||||||
|
)
|
||||||
|
embed.set_image(queued.player.thumbnail_url)
|
||||||
|
|
||||||
|
if first and len(players[message.guild.id].queue) == 0:
|
||||||
|
client.loop.create_task(utils.reply(message, embed=embed))
|
||||||
|
else:
|
||||||
|
client.loop.create_task(utils.channel_send(message, embed=embed))
|
||||||
|
|
||||||
|
|
||||||
|
def remove_queued(messages):
|
||||||
|
if messages[0].guild.id not in players:
|
||||||
|
return
|
||||||
|
|
||||||
|
if len(players[messages[0].guild.id].queue) == 0:
|
||||||
|
return
|
||||||
|
|
||||||
|
found = []
|
||||||
|
for message in messages:
|
||||||
|
for queued in players[message.guild.id].queue:
|
||||||
|
if queued.trigger_message.id == message.id:
|
||||||
|
found.append(queued)
|
||||||
|
for queued in found:
|
||||||
|
players[messages[0].guild.id].queue.remove(queued)
|
||||||
|
|
||||||
|
|
||||||
|
async def ensure_joined(message):
|
||||||
|
if message.guild.voice_client is None:
|
||||||
|
if message.author.voice:
|
||||||
|
await message.author.voice.channel.connect()
|
||||||
|
else:
|
||||||
|
await utils.reply(message, "you are not connected to a voice channel!")
|
||||||
|
|
||||||
|
|
||||||
|
def command_allowed(message, immutable=False):
|
||||||
|
if not message.guild.voice_client:
|
||||||
|
return
|
||||||
|
if immutable:
|
||||||
|
return message.channel.id == message.guild.voice_client.channel.id
|
||||||
|
else:
|
||||||
|
if not message.author.voice:
|
||||||
|
return False
|
||||||
|
return message.author.voice.channel.id == message.guild.voice_client.channel.id
|
@ -20,7 +20,7 @@ def prepare():
|
|||||||
|
|
||||||
|
|
||||||
async def on_bulk_message_delete(messages):
|
async def on_bulk_message_delete(messages):
|
||||||
commands.voice.delete_queued(messages)
|
commands.voice.remove_queued(messages)
|
||||||
|
|
||||||
|
|
||||||
async def on_message(message):
|
async def on_message(message):
|
||||||
@ -28,7 +28,7 @@ async def on_message(message):
|
|||||||
|
|
||||||
|
|
||||||
async def on_message_delete(message):
|
async def on_message_delete(message):
|
||||||
commands.voice.delete_queued([message])
|
commands.voice.remove_queued([message])
|
||||||
|
|
||||||
|
|
||||||
async def on_message_edit(before, after):
|
async def on_message_edit(before, after):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user