Docstring missing for
main
13logging.basicConfig(level=logging.INFO)
14
15
16def main():17 load_dotenv()
18
19 loop = asyncio.new_event_loop()
Docstring missing for
load
6 # This makes the DeferredAudioTrack highly efficient, particularly in cases
7 # where large playlists are loaded.
8
9 async def load(self, client): # skipcq: PYL-W020110 result: LoadResult = await client.get_tracks(
11 f'ytsearch:{self.title} {self.author}'
12 ) # Search for our track on YouTube.
Docstring missing for
load_item
346
347 self.sources.sort(key=lambda x: x.priority, reverse=True)
348
349 async def load_item(self, client: Client, query: str) -> Optional[LoadResult]:350 for source in self.sources:
351 if not source.check_query(query):
352 continue
Docstring missing for
initial_sources
340
341 self.initial_sources()
342
343 def initial_sources(self):344 for cls in BaseSource.__subclasses__():
345 self.sources.append(cls())
346
Docstring missing for
load_item
304
305 return True
306
307 async def load_item(self, client: Client, query: str) -> Optional[LoadResult]:308 try:
309 url_info = self.ytdl.extract_info(query, download=False)
310
Docstring missing for
check_query
293 {"format": "bestaudio"}
294 )
295
296 def check_query(self, query: str) -> bool:297 youtube_url_rx = r"^(https?://(www\.)?(youtube\.com|music\.youtube\.com)/(watch\?v=|playlist\?list=)([a-zA-Z0-9_-]+))"
298
299 if re.match(youtube_url_rx, query):
Docstring missing for
load_item
242 def check_query(self, query: str) -> bool:
243 return query.startswith('https://www.bilibili.com/video/') or query.startswith('https://b23.tv/')
244
245 async def load_item(self, client: Client, query: str) -> Optional[LoadResult]:246 audio_url, title = self.get_audio(query)
247
248 track = (await client.get_tracks(audio_url, check_local=False)).tracks[0]
Docstring missing for
check_query
239
240 self.priority = 5
241
242 def check_query(self, query: str) -> bool:243 return query.startswith('https://www.bilibili.com/video/') or query.startswith('https://b23.tv/')
244
245 async def load_item(self, client: Client, query: str) -> Optional[LoadResult]:
Docstring missing for
load_item
63
64 return False
65
66 async def load_item(self, client: Client, query: str): 67 track = self.__load_track(query)
68
69 if track:
Docstring missing for
check_query
55
56 Variables.SPOTIFY_CLIENT = Spotify(auth_manager=credentials)
57
58 def check_query(self, query: str) -> bool: 59 spotify_url_rx = r'^(https://open\.spotify\.com/)(track|album|playlist)/([a-zA-Z0-9]+)(.*)$'
60
61 if re.match(spotify_url_rx, query):
Docstring missing for
generate_display_embed
217 player.store('message', message.id)
218
219
220def generate_display_embed(bot: Bot, player: DefaultPlayer) -> Embed:221 # TODO: Complete this embed
222 embed = Embed()
223
Docstring missing for
split_list
16from library.variables import Variables
17
18
19def split_list(input_list, chunk_size) -> Iterable[list]: 20 length = len(input_list)
21
22 num_sublists = length // chunk_size
Docstring missing for
on_voice_server_update
19
20 super().__init__(bot, channel)
21
22 async def on_voice_server_update(self, data):23 # the data needs to be transformed before being handed down to
24 # voice_update_handler
25 lavalink_data = {
Docstring missing for
on_voice_state_update
28 }
29 await self.bot.lavalink.voice_update_handler(lavalink_data)
30
31 async def on_voice_state_update(self, data):32 # the data needs to be transformed before being handed down to
33 # voice_update_handler
34 lavalink_data = {
Docstring missing for
on_ready
16 with open("configs/icons.json", "r", encoding="utf-8") as f:
17 self.icons = json.load(f)
18
19 async def on_ready(self):20 self.__setup_lavalink_client()
21
22 def __setup_lavalink_client(self):
Docstring missing for
cog_load
18 def __init__(self, bot: Bot):
19 self.bot = bot
20
21 async def cog_load(self): 22 await self.bot.wait_until_ready()
23
24 lavalink.add_event_hook(self.track_hook)
Docstring missing for
on_voice_state_update
90 await interaction.edit_original_response(embed=embed)
91
92 @commands.Cog.listener(name="on_voice_state_update")
93 async def on_voice_state_update(self, member, before, after): 94 if (
95 before.channel is not None
96 and after.channel is None
Docstring missing for
on_message_interaction
107 pass
108
109 @commands.Cog.listener(name="on_message_interaction")
110 async def on_message_interaction(self, interaction: MessageInteraction):111 if interaction.data.custom_id.startswith("control"):
112 if interaction.data.custom_id.startswith("control.empty"):
113 await interaction.response.edit_message()
Docstring missing for
setup
156 await update_display(self.bot, player, interaction=interaction)
157
158
159def setup(bot):160 bot.add_cog(Events(bot))
Docstring missing for
on_slash_command_error
68 await update_display(self.bot, player, message, delay=5)
69
70 @commands.Cog.listener(name="on_slash_command_error")
71 async def on_slash_command_error(self, interaction: ApplicationCommandInteraction, error: CommandInvokeError): 72 if isinstance(error.original, MissingVoicePermissions):
73 embed = ErrorEmbed("指令錯誤", "我需要 `連接` 和 `說話` 權限才能夠播放音樂")
74
Docstring missing for
track_hook
23
24 lavalink.add_event_hook(self.track_hook)
25
26 async def track_hook(self, event): 27 if isinstance(event, PlayerUpdateEvent):
28 player: DefaultPlayer = event.player
29
Description
The module/function docstring is missing.
If you want to ignore this, you can configure this in the .deepsource.toml
file. Please refer to docs for available options.