update with new features of audio cog

This commit is contained in:
brandons209 2020-11-19 04:19:10 -05:00
parent b31fa51f6b
commit bb082f8d75

View file

@ -85,7 +85,7 @@
seek = 0 seek = 0
if not await self.is_query_allowed( if not await self.is_query_allowed(
self.config, ctx.guild, f"{query}", query_obj=query self.config, ctx, f"{query}", query_obj=query
): ):
raise QueryUnauthorized( raise QueryUnauthorized(
_("{query} is not an allowed query.").format(query=query.to_string_user()) _("{query} is not an allowed query.").format(query=query.to_string_user())
@ -160,11 +160,12 @@
single_track.start_timestamp = seek * 1000 single_track.start_timestamp = seek * 1000
if not await self.is_query_allowed( if not await self.is_query_allowed(
self.config, self.config,
ctx.guild, ctx,
( (
f"{single_track.title} {single_track.author} {single_track.uri} " f"{single_track.title} {single_track.author} {single_track.uri} "
f"{str(Query.process_input(single_track, self.local_folder_current_path))}" f"{str(Query.process_input(single_track, self.local_folder_current_path))}"
), ),
query_obj=query
): ):
if IS_DEBUG: if IS_DEBUG:
log.debug(f"Query is not allowed in {ctx.guild} ({ctx.guild.id})") log.debug(f"Query is not allowed in {ctx.guild} ({ctx.guild.id})")
@ -174,6 +175,13 @@
) )
elif guild_data["maxlength"] > 0: elif guild_data["maxlength"] > 0:
if self.is_track_length_allowed(single_track, guild_data["maxlength"]): if self.is_track_length_allowed(single_track, guild_data["maxlength"]):
single_track.extras.update(
{
"enqueue_time": int(time.time()),
"vc": player.channel.id,
"requester": ctx.author.id,
}
)
player.add(ctx.author, single_track) player.add(ctx.author, single_track)
player.maybe_shuffle() player.maybe_shuffle()
self.bot.dispatch( self.bot.dispatch(
@ -189,6 +197,13 @@
) )
else: else:
single_track.extras.update(
{
"enqueue_time": int(time.time()),
"vc": player.channel.id,
"requester": ctx.author.id,
}
)
player.add(ctx.author, single_track) player.add(ctx.author, single_track)
player.maybe_shuffle() player.maybe_shuffle()
self.bot.dispatch( self.bot.dispatch(