Compare commits
No commits in common. "f4b7e0f5ce8b31407929a35001df20cf8d94688c" and "b6d105a519c66a12f6d9b1b4a594b0f5e5289447" have entirely different histories.
f4b7e0f5ce
...
b6d105a519
@ -15,6 +15,9 @@ 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:
|
||||||
|
players[message.guild.id] = audio.queue.Player()
|
||||||
|
|
||||||
tokens = commands.tokenize(message.content)
|
tokens = commands.tokenize(message.content)
|
||||||
parser = arguments.ArgumentParser(
|
parser = arguments.ArgumentParser(
|
||||||
tokens[0],
|
tokens[0],
|
||||||
@ -78,23 +81,19 @@ async def queue_or_play(message, edited=False):
|
|||||||
elif not command_allowed(message):
|
elif not command_allowed(message):
|
||||||
return
|
return
|
||||||
|
|
||||||
if message.guild.id not in players:
|
|
||||||
players[message.guild.id] = audio.queue.Player()
|
|
||||||
|
|
||||||
if edited:
|
if edited:
|
||||||
found = next(
|
found = None
|
||||||
filter(
|
for queued in players[message.guild.id].queue:
|
||||||
lambda queued: queued.trigger_message.id == message.id,
|
if queued.trigger_message.id == message.id:
|
||||||
players[message.guild.id].queue,
|
found = queued
|
||||||
),
|
break
|
||||||
None,
|
|
||||||
)
|
|
||||||
if found:
|
if found:
|
||||||
players[message.guild.id].queue.remove(found)
|
players[message.guild.id].queue.remove(found)
|
||||||
|
|
||||||
if args.clear:
|
if args.clear:
|
||||||
players[message.guild.id].queue.clear()
|
players[message.guild.id].queue.clear()
|
||||||
await utils.add_check_reaction(message)
|
await utils.add_check_reaction(message)
|
||||||
|
return
|
||||||
elif indices := args.remove_index:
|
elif indices := args.remove_index:
|
||||||
targets = []
|
targets = []
|
||||||
for i in indices:
|
for i in indices:
|
||||||
@ -115,15 +114,15 @@ async def queue_or_play(message, edited=False):
|
|||||||
f"removed **{len(targets)}** queued {'song' if len(targets) == 1 else 'songs'}",
|
f"removed **{len(targets)}** queued {'song' if len(targets) == 1 else 'songs'}",
|
||||||
)
|
)
|
||||||
elif args.remove_title or args.remove_queuer:
|
elif args.remove_title or args.remove_queuer:
|
||||||
targets = set()
|
targets = []
|
||||||
for queued in players[message.guild.id].queue:
|
for queued in players[message.guild.id].queue:
|
||||||
if t := args.remove_title:
|
if t := args.remove_title:
|
||||||
if t in queued.player.title:
|
if t in queued.player.title:
|
||||||
targets.add(queued)
|
targets.append(queued)
|
||||||
|
continue
|
||||||
if q := args.remove_queuer:
|
if q := args.remove_queuer:
|
||||||
if q == queued.trigger_message.author.id:
|
if q == queued.trigger_message.author.id:
|
||||||
targets.add(queued)
|
targets.append(queued)
|
||||||
targets = list(targets)
|
|
||||||
if not args.match_multiple:
|
if not args.match_multiple:
|
||||||
targets = targets[:1]
|
targets = targets[:1]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user