fix(commands/voice/sponsorblock): use youtubedl duration and make sponsorblock default
This commit is contained in:
parent
26f81bd58f
commit
ca9f811e8f
@ -1,11 +1,11 @@
|
|||||||
import disnake_paginator
|
|
||||||
|
|
||||||
import arguments
|
import arguments
|
||||||
|
import disnake_paginator
|
||||||
|
from constants import EMBED_COLOR
|
||||||
|
from state import players
|
||||||
|
|
||||||
import commands
|
import commands
|
||||||
import sponsorblock
|
import sponsorblock
|
||||||
import utils
|
import utils
|
||||||
from constants import EMBED_COLOR
|
|
||||||
from state import players
|
|
||||||
|
|
||||||
from .utils import command_allowed
|
from .utils import command_allowed
|
||||||
|
|
||||||
@ -89,19 +89,15 @@ async def pause(message):
|
|||||||
|
|
||||||
async def fast_forward(message):
|
async def fast_forward(message):
|
||||||
tokens = commands.tokenize(message.content)
|
tokens = commands.tokenize(message.content)
|
||||||
parser = arguments.ArgumentParser(tokens[0], "fast forward audio playback")
|
parser = arguments.ArgumentParser(
|
||||||
group = parser.add_mutually_exclusive_group(required=True)
|
tokens[0], "skip current sponsorblock segment"
|
||||||
group.add_argument(
|
)
|
||||||
|
parser.add_argument(
|
||||||
"-s",
|
"-s",
|
||||||
"--seconds",
|
"--seconds",
|
||||||
|
nargs="?",
|
||||||
type=lambda v: arguments.range_type(v, min=0, max=300),
|
type=lambda v: arguments.range_type(v, min=0, max=300),
|
||||||
help="the amount of seconds to fast forward",
|
help="the amount of seconds to fast forward instead",
|
||||||
)
|
|
||||||
group.add_argument(
|
|
||||||
"-S",
|
|
||||||
"--sponsorblock",
|
|
||||||
action="store_true",
|
|
||||||
help="go to the end of the current sponsorblock segment",
|
|
||||||
)
|
)
|
||||||
if not (args := await parser.parse_args(message, tokens)):
|
if not (args := await parser.parse_args(message, tokens)):
|
||||||
return
|
return
|
||||||
@ -114,7 +110,7 @@ async def fast_forward(message):
|
|||||||
return
|
return
|
||||||
|
|
||||||
seconds = args.seconds
|
seconds = args.seconds
|
||||||
if args.sponsorblock:
|
if not seconds:
|
||||||
video = await sponsorblock.get_segments(
|
video = await sponsorblock.get_segments(
|
||||||
players[message.guild.id].current.player.id
|
players[message.guild.id].current.player.id
|
||||||
)
|
)
|
||||||
|
@ -2,6 +2,7 @@ import disnake
|
|||||||
|
|
||||||
import sponsorblock
|
import sponsorblock
|
||||||
import utils
|
import utils
|
||||||
|
import youtubedl
|
||||||
from constants import EMBED_COLOR
|
from constants import EMBED_COLOR
|
||||||
from state import players
|
from state import players
|
||||||
|
|
||||||
@ -31,7 +32,7 @@ async def sponsorblock_command(message):
|
|||||||
|
|
||||||
current = "**" if progress >= begin and progress < end else ""
|
current = "**" if progress >= begin and progress < end else ""
|
||||||
text.append(
|
text.append(
|
||||||
f"{current}`{utils.format_duration(begin, short=True)}` - `{utils.format_duration(end, short=True)}`: {category_name if category_name else 'Unknown'}{current}"
|
f"{current}`{youtubedl.format_duration(begin)}` - `{youtubedl.format_duration(end)}`: {category_name if category_name else 'Unknown'}{current}"
|
||||||
)
|
)
|
||||||
|
|
||||||
await utils.reply(
|
await utils.reply(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user