99from disnake .ext import commands
1010from disnake .ui import Button , View
1111
12- from config import OWNER_IDS
1312from modules import errors as em
1413
15- ### Check if user is bot owner ###
16-
14+ OWNER_IDS = [int (i ) for i in os .getenv ("OWNER_IDS" , "" ).replace (" " , "" ).split ("," ) if i ]
1715
1816def is_bot_owner ():
1917 """Check if the user is the bot owner."""
@@ -24,29 +22,17 @@ def predicate(ctx):
2422
2523 return commands .check (predicate )
2624
27-
2825class OwnerModule (commands .Cog ):
2926 """Cog for bot owner commands"""
3027 def __init__ (self , bot ):
3128 self .bot = bot
3229
33- ### Reboot command for bot owner ###
34-
3530 @commands .command ()
3631 @is_bot_owner ()
3732 async def reboot (self , ctx ):
3833 """Reboot command for bot owner"""
3934 bot = self .bot
40- resp_embed = bot .err_embed (ctx )
41- err_embed = bot .err_embed (ctx )
42-
43- if ctx .author .id not in OWNER_IDS :
44- resp_embed .description = "У вас нет прав на перезагрузку бота."
45- return await ctx .send (embed = err_embed , delete_after = 10 )
46-
47- resp_embed .title = "Подтверждение перезагрузки"
48- resp_embed .description = "Вы уверены что хотите перезапустить бота?"
49- resp_embed .color = disnake .Color .orange ()
35+ err_embed = bot .bot_embed (ctx )
5036
5137 class ConfirmView (View ):
5238 """View for confirmation buttons"""
@@ -114,6 +100,11 @@ async def on_timeout(self):
114100 except (disnake .Forbidden , disnake .HTTPException , disnake .NotFound ):
115101 pass
116102
103+ resp_embed = self .bot .bot_embed (ctx )
104+ resp_embed .title = "Подтверждение перезагрузки"
105+ resp_embed .description = "Вы уверены что хотите перезапустить бота?"
106+ resp_embed .color = disnake .Color .orange ()
107+
117108 message = await ctx .send (embed = resp_embed , view = ConfirmView ())
118109
119110
0 commit comments