@@ -33,9 +33,7 @@ async def command_disconnect(self, ctx: commands.Context):
3333 if not self ._player_check (ctx ):
3434 return await self .send_embed_msg (ctx , title = _ ("Nothing playing." ))
3535 else :
36- dj_enabled = self ._dj_status_cache .setdefault (
37- ctx .guild .id , await self .config .guild (ctx .guild ).dj_enabled ()
38- )
36+ dj_enabled = self ._dj_status_cache .get (ctx .guild .id )
3937 vote_enabled = await self .config .guild (ctx .guild ).vote_enabled ()
4038 player = lavalink .get_player (ctx .guild .id )
4139 can_skip = await self ._can_instaskip (ctx , ctx .author )
@@ -146,9 +144,7 @@ async def command_now(self, ctx: commands.Context):
146144
147145 player .store ("np_message" , message )
148146
149- dj_enabled = self ._dj_status_cache .setdefault (
150- ctx .guild .id , await self .config .guild (ctx .guild ).dj_enabled ()
151- )
147+ dj_enabled = self ._dj_status_cache .get (ctx .guild .id )
152148 vote_enabled = await self .config .guild (ctx .guild ).vote_enabled ()
153149 if (
154150 (dj_enabled or vote_enabled )
@@ -198,9 +194,7 @@ async def command_now(self, ctx: commands.Context):
198194 @commands .bot_has_permissions (embed_links = True )
199195 async def command_pause (self , ctx : commands .Context ):
200196 """Pause or resume a playing track."""
201- dj_enabled = self ._dj_status_cache .setdefault (
202- ctx .guild .id , await self .config .guild (ctx .guild ).dj_enabled ()
203- )
197+ dj_enabled = self ._dj_status_cache .get (ctx .guild .id )
204198 if not self ._player_check (ctx ):
205199 return await self .send_embed_msg (ctx , title = _ ("Nothing playing." ))
206200 player = lavalink .get_player (ctx .guild .id )
@@ -242,9 +236,7 @@ async def command_prev(self, ctx: commands.Context):
242236 """Skip to the start of the previously played track."""
243237 if not self ._player_check (ctx ):
244238 return await self .send_embed_msg (ctx , title = _ ("Nothing playing." ))
245- dj_enabled = self ._dj_status_cache .setdefault (
246- ctx .guild .id , await self .config .guild (ctx .guild ).dj_enabled ()
247- )
239+ dj_enabled = self ._dj_status_cache .get (ctx .guild .id )
248240 vote_enabled = await self .config .guild (ctx .guild ).vote_enabled ()
249241 is_alone = await self .is_requester_alone (ctx )
250242 is_requester = await self .is_requester (ctx , ctx .author )
@@ -306,9 +298,7 @@ async def command_seek(self, ctx: commands.Context, seconds: Union[int, str]):
306298
307299 Accepts seconds or a value formatted like 00:00:00 (`hh:mm:ss`) or 00:00 (`mm:ss`).
308300 """
309- dj_enabled = self ._dj_status_cache .setdefault (
310- ctx .guild .id , await self .config .guild (ctx .guild ).dj_enabled ()
311- )
301+ dj_enabled = self ._dj_status_cache .get (ctx .guild .id )
312302 vote_enabled = await self .config .guild (ctx .guild ).vote_enabled ()
313303 is_alone = await self .is_requester_alone (ctx )
314304 is_requester = await self .is_requester (ctx , ctx .author )
@@ -389,9 +379,7 @@ async def command_seek(self, ctx: commands.Context, seconds: Union[int, str]):
389379 async def command_shuffle (self , ctx : commands .Context ):
390380 """Toggle shuffle."""
391381 if ctx .invoked_subcommand is None :
392- dj_enabled = self ._dj_status_cache .setdefault (
393- ctx .guild .id , await self .config .guild (ctx .guild ).dj_enabled ()
394- )
382+ dj_enabled = self ._dj_status_cache .get (ctx .guild .id )
395383 can_skip = await self ._can_instaskip (ctx , ctx .author )
396384 if dj_enabled and not can_skip :
397385 return await self .send_embed_msg (
@@ -433,9 +421,7 @@ async def command_shuffle_bumpped(self, ctx: commands.Context):
433421 Set this to disabled if you wish to avoid bumped songs being shuffled. This takes priority
434422 over `[p]shuffle`.
435423 """
436- dj_enabled = self ._dj_status_cache .setdefault (
437- ctx .guild .id , await self .config .guild (ctx .guild ).dj_enabled ()
438- )
424+ dj_enabled = self ._dj_status_cache .get (ctx .guild .id )
439425 can_skip = await self ._can_instaskip (ctx , ctx .author )
440426 if dj_enabled and not can_skip :
441427 return await self .send_embed_msg (
@@ -485,9 +471,7 @@ async def command_skip(self, ctx: commands.Context, skip_to_track: int = None):
485471 )
486472 if not player .current :
487473 return await self .send_embed_msg (ctx , title = _ ("Nothing playing." ))
488- dj_enabled = self ._dj_status_cache .setdefault (
489- ctx .guild .id , await self .config .guild (ctx .guild ).dj_enabled ()
490- )
474+ dj_enabled = self ._dj_status_cache .get (ctx .guild .id )
491475 vote_enabled = await self .config .guild (ctx .guild ).vote_enabled ()
492476 is_alone = await self .is_requester_alone (ctx )
493477 is_requester = await self .is_requester (ctx , ctx .author )
@@ -563,9 +547,7 @@ async def command_skip(self, ctx: commands.Context, skip_to_track: int = None):
563547 @commands .bot_has_permissions (embed_links = True )
564548 async def command_stop (self , ctx : commands .Context ):
565549 """Stop playback and clear the queue."""
566- dj_enabled = self ._dj_status_cache .setdefault (
567- ctx .guild .id , await self .config .guild (ctx .guild ).dj_enabled ()
568- )
550+ dj_enabled = self ._dj_status_cache .get (ctx .guild .id )
569551 vote_enabled = await self .config .guild (ctx .guild ).vote_enabled ()
570552 if not self ._player_check (ctx ):
571553 return await self .send_embed_msg (ctx , title = _ ("Nothing playing." ))
@@ -619,9 +601,7 @@ async def command_stop(self, ctx: commands.Context):
619601 @commands .bot_has_permissions (embed_links = True )
620602 async def command_summon (self , ctx : commands .Context ):
621603 """Summon the bot to a voice channel."""
622- dj_enabled = self ._dj_status_cache .setdefault (
623- ctx .guild .id , await self .config .guild (ctx .guild ).dj_enabled ()
624- )
604+ dj_enabled = self ._dj_status_cache .get (ctx .guild .id )
625605 vote_enabled = await self .config .guild (ctx .guild ).vote_enabled ()
626606 is_alone = await self .is_requester_alone (ctx )
627607 is_requester = await self .is_requester (ctx , ctx .author )
@@ -697,9 +677,7 @@ async def command_summon(self, ctx: commands.Context):
697677 @commands .bot_has_permissions (embed_links = True )
698678 async def command_volume (self , ctx : commands .Context , vol : int = None ):
699679 """Set the volume, 1% - 150%."""
700- dj_enabled = self ._dj_status_cache .setdefault (
701- ctx .guild .id , await self .config .guild (ctx .guild ).dj_enabled ()
702- )
680+ dj_enabled = self ._dj_status_cache .get (ctx .guild .id )
703681 can_skip = await self ._can_instaskip (ctx , ctx .author )
704682 max_volume = await self .config .guild (ctx .guild ).max_volume ()
705683
@@ -744,9 +722,7 @@ async def command_volume(self, ctx: commands.Context, vol: int = None):
744722 @commands .bot_has_permissions (embed_links = True )
745723 async def command_repeat (self , ctx : commands .Context ):
746724 """Toggle repeat."""
747- dj_enabled = self ._dj_status_cache .setdefault (
748- ctx .guild .id , await self .config .guild (ctx .guild ).dj_enabled ()
749- )
725+ dj_enabled = self ._dj_status_cache .get (ctx .guild .id )
750726 can_skip = await self ._can_instaskip (ctx , ctx .author )
751727 if dj_enabled and not can_skip and not await self ._has_dj_role (ctx , ctx .author ):
752728 return await self .send_embed_msg (
@@ -788,9 +764,7 @@ async def command_repeat(self, ctx: commands.Context):
788764 @commands .bot_has_permissions (embed_links = True )
789765 async def command_remove (self , ctx : commands .Context , index_or_url : Union [int , str ]):
790766 """Remove a specific track number from the queue."""
791- dj_enabled = self ._dj_status_cache .setdefault (
792- ctx .guild .id , await self .config .guild (ctx .guild ).dj_enabled ()
793- )
767+ dj_enabled = self ._dj_status_cache .get (ctx .guild .id )
794768 if not self ._player_check (ctx ):
795769 return await self .send_embed_msg (ctx , title = _ ("Nothing playing." ))
796770 player = lavalink .get_player (ctx .guild .id )
@@ -865,9 +839,7 @@ async def command_remove(self, ctx: commands.Context, index_or_url: Union[int, s
865839 @commands .bot_has_permissions (embed_links = True )
866840 async def command_bump (self , ctx : commands .Context , index : int ):
867841 """Bump a track number to the top of the queue."""
868- dj_enabled = self ._dj_status_cache .setdefault (
869- ctx .guild .id , await self .config .guild (ctx .guild ).dj_enabled ()
870- )
842+ dj_enabled = self ._dj_status_cache .get (ctx .guild .id )
871843 if not self ._player_check (ctx ):
872844 return await self .send_embed_msg (ctx , title = _ ("Nothing playing." ))
873845 player = lavalink .get_player (ctx .guild .id )
0 commit comments