17
17
class Skyblock (app_commands .Group ):
18
18
# Set command group name and description
19
19
def __init__ (self ):
20
- super ().__init__ (name = "skyblock" , description = "Hypixel Skyblock related commands" )
20
+ super ().__init__ (
21
+ name = "skyblock" , description = "Hypixel Skyblock related commands"
22
+ )
21
23
22
24
# Make a command to check the version of mods for Hypixel Skyblock
23
- @app_commands .command (name = "mods" ,
24
- description = "Check the latest release of the most popular mods for the Hypixel Skyblock" )
25
+ @app_commands .command (
26
+ name = "mods" ,
27
+ description = "Check the latest release of the most popular mods for the Hypixel Skyblock" ,
28
+ )
25
29
async def mods (self , interaction : discord .Interaction [ChouetteBot ]):
26
30
await interaction .response .defer (thinking = True )
27
31
api_github = "https://api.github.com/repos/"
28
32
async with aiohttp .ClientSession () as session :
29
- async with session .get (f"{ api_github } Dungeons-Guide/Skyblock-Dungeons-Guide/releases/latest" ) as response :
33
+ async with session .get (
34
+ f"{ api_github } Dungeons-Guide/Skyblock-Dungeons-Guide/releases/latest"
35
+ ) as response :
30
36
dungeonsguide = await response .json ()
31
- async with session .get (f"{ api_github } Moulberry/NotEnoughUpdates/releases/latest" ) as response :
37
+ async with session .get (
38
+ f"{ api_github } Moulberry/NotEnoughUpdates/releases/latest"
39
+ ) as response :
32
40
notenoughupdates = await response .json ()
33
- async with session .get (f"{ api_github } BiscuitDevelopment/SkyblockAddons/releases/latest" ) as response :
41
+ async with session .get (
42
+ f"{ api_github } BiscuitDevelopment/SkyblockAddons/releases/latest"
43
+ ) as response :
34
44
skyblockaddons = await response .json ()
35
- async with session .get (f"{ api_github } Skytils/SkytilsMod/releases/latest" ) as response :
45
+ async with session .get (
46
+ f"{ api_github } Skytils/SkytilsMod/releases/latest"
47
+ ) as response :
36
48
skytils = await response .json ()
37
- await interaction .followup .send (f"The latest releases are :\n "
38
- f"Dungeons Guide : `{ dungeonsguide ['name' ].replace ('v' , '' )} `\n "
39
- f"Not Enough Updates : `{ notenoughupdates ['name' ]} `\n "
40
- f"SkyblockAddons : `{ skyblockaddons ['name' ].replace ('Patch v' , '' )} `\n "
41
- f"Skytils : `{ skytils ['name' ].replace ('Skytils ' , '' )} `" )
49
+ await interaction .followup .send (
50
+ f"The latest releases are :\n "
51
+ f"Dungeons Guide : `{ dungeonsguide ['name' ].replace ('v' , '' )} `\n "
52
+ f"Not Enough Updates : `{ notenoughupdates ['name' ]} `\n "
53
+ f"SkyblockAddons : `{ skyblockaddons ['name' ].replace ('Patch v' , '' )} `\n "
54
+ f"Skytils : `{ skytils ['name' ].replace ('Skytils ' , '' )} `"
55
+ )
42
56
43
57
# Make a command to check if it's raining in Spider's Den in Hypixel Skyblock
44
- @app_commands .command (name = "spider_rain" , description = "Show the time until the next rain and thunderstorm" )
58
+ @app_commands .command (
59
+ name = "spider_rain" ,
60
+ description = "Show the time until the next rain and thunderstorm" ,
61
+ )
45
62
async def spider (self , interaction : discord .Interaction [ChouetteBot ]):
46
- utc_last_thunderstorm = round (datetime (2023 , 3 , 27 , 1 , 45 , 56 , tzinfo = timezone .utc ).timestamp ())
63
+ utc_last_thunderstorm = round (
64
+ datetime (2023 , 3 , 27 , 1 , 45 , 56 , tzinfo = timezone .utc ).timestamp ()
65
+ )
47
66
time_now = round (datetime .now (tz = timezone .utc ).timestamp ())
48
67
base = time_now - utc_last_thunderstorm
49
68
thunderstorm = base % ((3850 + 1000 ) * 4 )
@@ -56,24 +75,46 @@ async def spider(self, interaction: discord.Interaction[ChouetteBot]):
56
75
rain_msg = f"The rain will end <t:{ rain_duration } :R>"
57
76
if thunderstorm <= (3850 * 4 + 1000 * 3 ):
58
77
next_thunderstorm = time_now + (3850 * 4 + 1000 * 3 ) - thunderstorm
59
- thunderstorm_msg = f"The next thunderstorm will be <t:{ next_thunderstorm } :R>"
78
+ thunderstorm_msg = (
79
+ f"The next thunderstorm will be <t:{ next_thunderstorm } :R>"
80
+ )
60
81
else :
61
- thunderstorm_duration = time_now + (3850 * 4 + 1000 * 4 ) - thunderstorm
62
- thunderstorm_msg = f"The thunderstorm will end <t:{ thunderstorm_duration } :R>"
63
- await interaction .response .send_message (f"{ rain_msg } \n { thunderstorm_msg } " )
82
+ thunderstorm_duration = (
83
+ time_now + (3850 * 4 + 1000 * 4 ) - thunderstorm
84
+ )
85
+ thunderstorm_msg = (
86
+ f"The thunderstorm will end <t:{ thunderstorm_duration } :R>"
87
+ )
88
+ await interaction .response .send_message (
89
+ f"{ rain_msg } \n { thunderstorm_msg } "
90
+ )
64
91
65
92
# Make a command to check if the user is in the guild in-game
66
- @app_commands .command (name = "guild" , description = "Give a role if in the guild in-game" )
93
+ @app_commands .command (
94
+ name = "guild" , description = "Give a role if in the guild in-game"
95
+ )
67
96
@app_commands .rename (pseudo = "pseudo_mc" )
68
- async def in_guild (self , interaction : discord .Interaction [ChouetteBot ], pseudo : str ):
69
- if interaction .user .get_role (int (interaction .client .config ['HYPIXEL_GUILD_ROLE' ])):
97
+ async def in_guild (
98
+ self , interaction : discord .Interaction [ChouetteBot ], pseudo : str
99
+ ):
100
+ if interaction .user .get_role (
101
+ int (interaction .client .config ["HYPIXEL_GUILD_ROLE" ])
102
+ ):
70
103
await interaction .response .send_message ("Vous avez déjà le rôle !" )
71
104
return
72
105
await interaction .response .defer (thinking = True )
73
- checked = check (pseudo , interaction .client .config ['HYPIXEL_GUILD_NAME' ], interaction .user .global_name )
106
+ checked = check (
107
+ pseudo ,
108
+ interaction .client .config ["HYPIXEL_GUILD_NAME" ],
109
+ interaction .user .global_name ,
110
+ )
74
111
if checked :
75
- role = interaction .guild .get_role (int (interaction .client .config ['HYPIXEL_GUILD_ROLE' ]))
112
+ role = interaction .guild .get_role (
113
+ int (interaction .client .config ["HYPIXEL_GUILD_ROLE" ])
114
+ )
76
115
await interaction .user .add_roles (role )
77
- await interaction .followup .send ("Vous avez été assigné le rôle de membre !" )
116
+ await interaction .followup .send (
117
+ "Vous avez été assigné le rôle de membre !"
118
+ )
78
119
else :
79
120
await interaction .followup .send (checked )
0 commit comments