Skip to content

Commit 15dff6c

Browse files
authored
Merge pull request #79 from Maveo/fix/pycord-update
pycord update
2 parents 7b1ec6b + 46220e4 commit 15dff6c

File tree

15 files changed

+48
-48
lines changed

15 files changed

+48
-48
lines changed

bot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,8 @@ async def sync_commands(self, tried=0):
254254
command.name))
255255
self.bot.add_application_command(command)
256256
try:
257-
await self.bot.sync_commands()
257+
# TODO: do we use force or not?
258+
await self.bot.sync_commands(force=True)
258259
self.logger.info('synced bot command modules {}'.format(modules_to_guilds))
259260
except discord.HTTPException as e:
260261
if tried < self.max_sync_commands_tries:

modules/boost/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ async def boost_user(self, member: discord.Member, member_to_boost: discord.Memb
144144
def __init__(self, bot):
145145
super().__init__(bot)
146146

147-
async def boost(ctx: discord.commands.context.ApplicationContext,
147+
async def boost(ctx: discord.ApplicationContext,
148148
member: discord.commands.Option(
149149
discord.Member,
150150
description=bot.i18n.get('BOOST_MEMBER_OPTION'),

modules/emoji_reactions/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def __init__(self,
3737
callback: Callable[['CustomModal', discord.Interaction], Coroutine],
3838
title: str):
3939
self.custom_callback = callback
40-
super().__init__(title)
40+
super().__init__(title=title)
4141

4242
async def callback(self, interaction: discord.Interaction):
4343
await self.custom_callback(self, interaction)
@@ -66,7 +66,7 @@ def __init__(self, bot):
6666
self.activating_reactions = {}
6767

6868
@bot.has_permissions(administrator=True)
69-
async def add_emoji_action(ctx: discord.commands.context.ApplicationContext,
69+
async def add_emoji_action(ctx: discord.ApplicationContext,
7070
message: discord.Message):
7171
async def custom_emoji_response(button: CustomButton, interaction1: discord.Interaction):
7272
m = await ctx.send(embed=discord.Embed(
@@ -108,7 +108,7 @@ async def response(dropdown1: CustomDropdown, interaction1: discord.Interaction)
108108
await ctx.respond(view=paginator.view(), ephemeral=True)
109109

110110
@bot.has_permissions(administrator=True)
111-
async def get_emoji_reactions(ctx: discord.commands.context.ApplicationContext):
111+
async def get_emoji_reactions(ctx: discord.ApplicationContext):
112112
reactions = self.bot.db.get_emoji_reactions(ctx.guild.id)
113113
embed = discord.Embed(title=self.bot.i18n.get('EMOJI_REACTIONS_TITLE'), color=discord.Color.green())
114114

@@ -153,7 +153,7 @@ async def remove_emoji_reaction_autocomplete(ctx: discord.AutocompleteContext):
153153
return tools.autocomplete_match(ctx.value, reactions)
154154

155155
@bot.has_permissions(administrator=True)
156-
async def remove_emoji_reaction(ctx: discord.commands.context.ApplicationContext,
156+
async def remove_emoji_reaction(ctx: discord.ApplicationContext,
157157
reaction: discord.commands.Option(
158158
str,
159159
description=bot.i18n.get('REMOVE_REACTION_OPTION'),

modules/games/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ class GamesModule(SparkModule):
1515
def __init__(self, bot):
1616
super().__init__(bot)
1717

18-
async def tic_tac_toe(ctx: discord.commands.context.ApplicationContext):
18+
async def tic_tac_toe(ctx: discord.ApplicationContext):
1919
await TicTacToeViewHolder(bot, ctx).start()
2020

21-
async def chess(ctx: discord.commands.context.ApplicationContext):
21+
async def chess(ctx: discord.ApplicationContext):
2222
await ChessViewHolder(self.bot, ctx).start()
2323

2424
self.commands = [

modules/games/chess.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@ def update_view(self, view: ChessView):
10831083
child.label = str(piece.emoji())
10841084
child.disabled = self.chess_game.turn != piece.color or not self.chess_game.has_valid_move(child.pos)
10851085

1086-
def __init__(self, bot: 'DiscordBot', ctx: discord.commands.context.ApplicationContext):
1086+
def __init__(self, bot: 'DiscordBot', ctx: discord.ApplicationContext):
10871087
self.bot = bot
10881088

10891089
self.selected_pos: Tuple[int, int] or None = None
@@ -1114,7 +1114,7 @@ def __init__(self, bot: 'DiscordBot', ctx: discord.commands.context.ApplicationC
11141114
child.label = piece.emoji()
11151115
self.promotion_view.add_item(child)
11161116

1117-
self.original_context: discord.commands.context.ApplicationContext = ctx
1117+
self.original_context: discord.ApplicationContext = ctx
11181118
self.view_messages: List[int] or None = None
11191119
self.current_player = True
11201120
self.white_players = []

modules/games/tictactoe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def check_board_winner(self):
145145

146146

147147
class TicTacToeViewHolder:
148-
def __init__(self, bot: 'DiscordBot', ctx: discord.commands.context.ApplicationContext):
148+
def __init__(self, bot: 'DiscordBot', ctx: discord.ApplicationContext):
149149
self.ctx = ctx
150150
self.bot = bot
151151

modules/general/__init__.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ async def setting_key_autocomplete(ctx: discord.AutocompleteContext):
4343
return autocomplete_match(ctx.value, self.bot.module_manager.settings.keys(ctx.interaction.guild.id))
4444

4545
@bot.has_permissions(administrator=True)
46-
async def set_setting(ctx: discord.commands.context.ApplicationContext,
46+
async def set_setting(ctx: discord.ApplicationContext,
4747
key: discord.commands.Option(
4848
str,
4949
description=bot.i18n.get('SET_SETTING_KEY_OPTION'),
@@ -66,7 +66,7 @@ async def set_setting(ctx: discord.commands.context.ApplicationContext,
6666
color=discord.Color.red()))
6767

6868
@bot.has_permissions(administrator=True)
69-
async def get_setting(ctx: discord.commands.context.ApplicationContext,
69+
async def get_setting(ctx: discord.ApplicationContext,
7070
key: discord.commands.Option(
7171
str,
7272
description=bot.i18n.get('GET_SETTING_KEY_OPTION'),
@@ -87,7 +87,7 @@ async def get_setting(ctx: discord.commands.context.ApplicationContext,
8787
color=discord.Color.red()))
8888

8989
@bot.has_permissions(administrator=True)
90-
async def reset_setting(ctx: discord.commands.context.ApplicationContext,
90+
async def reset_setting(ctx: discord.ApplicationContext,
9191
key: discord.commands.Option(
9292
str,
9393
description=bot.i18n.get('RESET_SETTING_KEY_OPTION'),
@@ -135,9 +135,9 @@ async def activate_module_autocomplete(ctx: discord.AutocompleteContext):
135135
self.bot.module_manager.get_activatable_modules(ctx.interaction.guild.id))
136136

137137
@bot.has_permissions(administrator=True)
138-
async def activate_module(ctx: discord.commands.context.ApplicationContext,
138+
async def activate_module(ctx: discord.ApplicationContext,
139139
module: discord.commands.Option(
140-
str,
140+
type=str,
141141
description=bot.i18n.get('MODULE_ACTIVATE_OPTION'),
142142
autocomplete=activate_module_autocomplete,
143143
)):
@@ -162,7 +162,7 @@ async def deactivate_module_autocomplete(ctx: discord.AutocompleteContext):
162162
self.bot.module_manager.get_deactivatable_modules(ctx.interaction.guild.id))
163163

164164
@bot.has_permissions(administrator=True)
165-
async def deactivate_module(ctx: discord.commands.context.ApplicationContext,
165+
async def deactivate_module(ctx: discord.ApplicationContext,
166166
module: discord.commands.Option(
167167
str,
168168
description=bot.i18n.get('MODULE_DEACTIVATE_OPTION'),
@@ -184,7 +184,7 @@ async def deactivate_module(ctx: discord.commands.context.ApplicationContext,
184184
color=discord.Color.green()))
185185

186186
@bot.has_permissions(administrator=True)
187-
async def get_active_modules(ctx: discord.commands.context.ApplicationContext):
187+
async def get_active_modules(ctx: discord.ApplicationContext):
188188
return await ctx.respond(
189189
embed=discord.Embed(title=self.bot.i18n.get('ACTIVE_MODULES_TITLE'),
190190
description='\n'.join(

modules/inventory/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ class InventoryModule(SparkModule):
2323
def __init__(self, bot):
2424
super().__init__(bot)
2525

26-
async def get_inventory(ctx: discord.commands.context.ApplicationContext):
26+
async def get_inventory(ctx: discord.ApplicationContext):
2727
return await ctx.respond(file=await self.create_inventory_image(
2828
ctx.author.guild.id, (await self.get_inventory(ctx.author)).values()),
2929
ephemeral=True)
3030

31-
async def list_inventory(ctx: discord.commands.context.ApplicationContext):
31+
async def list_inventory(ctx: discord.ApplicationContext):
3232
embed = discord.Embed(title=bot.i18n.get('INVENTORY_USER_TITLE').format(ctx.author.display_name),
3333
description='',
3434
color=discord.Color.gold())
@@ -60,7 +60,7 @@ async def use_item_autocomplete(ctx: discord.AutocompleteContext):
6060
),
6161
self.bot.db.get_user_useable_items(ctx.interaction.guild.id, ctx.interaction.user.id))))
6262

63-
async def use_item(ctx: discord.commands.context.ApplicationContext,
63+
async def use_item(ctx: discord.ApplicationContext,
6464
item: discord.commands.Option(
6565
str,
6666
description=bot.i18n.get('INVENTORY_USE_ITEM_OPTION'),
@@ -87,7 +87,7 @@ async def equip_item_autocomplete(ctx: discord.AutocompleteContext):
8787
),
8888
self.bot.db.get_user_equippable_items(ctx.interaction.guild.id, ctx.interaction.user.id))))
8989

90-
async def equip_item(ctx: discord.commands.context.ApplicationContext,
90+
async def equip_item(ctx: discord.ApplicationContext,
9191
item: discord.commands.Option(
9292
str,
9393
description=bot.i18n.get('INVENTORY_EQUIP_ITEM_OPTION'),
@@ -114,7 +114,7 @@ async def unequip_item_autocomplete(ctx: discord.AutocompleteContext):
114114
),
115115
self.bot.db.get_user_equipped_items(ctx.interaction.guild.id, ctx.interaction.user.id))))
116116

117-
async def unequip_item(ctx: discord.commands.context.ApplicationContext,
117+
async def unequip_item(ctx: discord.ApplicationContext,
118118
item: discord.commands.Option(
119119
str,
120120
description=bot.i18n.get('INVENTORY_UNEQUIP_ITEM_OPTION'),
@@ -138,7 +138,7 @@ async def admin_item_type_autocomplete(ctx: discord.AutocompleteContext):
138138
self.bot.db.get_item_types(ctx.interaction.guild.id))))
139139

140140
@bot.has_permissions(administrator=True)
141-
async def admin_give_item(ctx: discord.commands.context.ApplicationContext,
141+
async def admin_give_item(ctx: discord.ApplicationContext,
142142
member: discord.Member,
143143
item_type: discord.commands.Option(
144144
str,

modules/levelsystem/__init__.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ def __init__(self, bot):
4747
super().__init__(bot)
4848

4949
@bot.has_permissions(administrator=True)
50-
async def get_levelsystem(ctx: discord.commands.context.ApplicationContext):
50+
async def get_levelsystem(ctx: discord.ApplicationContext):
5151
return await ctx.respond(embed=await self.lvlsys_get_embed(ctx.guild))
5252

5353
@bot.has_permissions(administrator=True)
54-
async def set_levelsystem(ctx: discord.commands.context.ApplicationContext,
54+
async def set_levelsystem(ctx: discord.ApplicationContext,
5555
level: discord.commands.Option(
5656
int,
5757
description=bot.i18n.get('LEVELSYSTEM_SET_LEVEL_ROLE_LEVEL_OPTION'),
@@ -68,7 +68,7 @@ async def set_levelsystem(ctx: discord.commands.context.ApplicationContext,
6868
return await ctx.respond(embed=await self.lvlsys_get_embed(ctx.guild))
6969

7070
@bot.has_permissions(administrator=True)
71-
async def remove_levelsystem(ctx: discord.commands.context.ApplicationContext,
71+
async def remove_levelsystem(ctx: discord.ApplicationContext,
7272
level: discord.commands.Option(
7373
int,
7474
description=bot.i18n.get('LEVELSYSTEM_REMOVE_LEVEL_ROLE_LEVEL_OPTION'),
@@ -80,7 +80,7 @@ async def remove_levelsystem(ctx: discord.commands.context.ApplicationContext,
8080
return await ctx.respond(embed=await self.lvlsys_get_embed(ctx.guild))
8181

8282
@bot.has_permissions(administrator=True)
83-
async def boost_add(ctx: discord.commands.context.ApplicationContext,
83+
async def boost_add(ctx: discord.ApplicationContext,
8484
member: discord.commands.Option(
8585
discord.Member,
8686
description=bot.i18n.get('LEVELSYSTEM_BOOST_ADD_MEMBER_OPTION'),
@@ -99,7 +99,7 @@ async def boost_add(ctx: discord.commands.context.ApplicationContext,
9999
color=discord.Color.green()))
100100

101101
@bot.has_permissions(administrator=True)
102-
async def set_level(ctx: discord.commands.context.ApplicationContext,
102+
async def set_level(ctx: discord.ApplicationContext,
103103
member: discord.commands.Option(
104104
discord.Member,
105105
description=bot.i18n.get('LEVELSYSTEM_SET_LEVEL_MEMBER_OPTION'),
@@ -120,7 +120,7 @@ async def set_level(ctx: discord.commands.context.ApplicationContext,
120120
color=discord.Color.green()))
121121

122122
@bot.has_permissions(administrator=True)
123-
async def blacklist_user(ctx: discord.commands.context.ApplicationContext,
123+
async def blacklist_user(ctx: discord.ApplicationContext,
124124
member: discord.commands.Option(
125125
discord.Member,
126126
description=bot.i18n.get('LEVELSYSTEM_BLACKLIST_MEMBER_OPTION'),
@@ -147,7 +147,7 @@ async def blacklist_user(ctx: discord.commands.context.ApplicationContext,
147147
color=discord.Color.green()))
148148

149149
@bot.has_permissions(administrator=True)
150-
async def blacklisted_users(ctx: discord.commands.context.ApplicationContext):
150+
async def blacklisted_users(ctx: discord.ApplicationContext):
151151
description = []
152152
for user in self.bot.db.get_blacklisted_level_users(ctx.guild.id, True):
153153
member = get(ctx.guild.members, id=int(user.user_id))
@@ -158,7 +158,7 @@ async def blacklisted_users(ctx: discord.commands.context.ApplicationContext):
158158
description='\n'.join(description),
159159
color=discord.Color.green()))
160160

161-
async def leaderboard(ctx: discord.commands.context.ApplicationContext):
161+
async def leaderboard(ctx: discord.ApplicationContext):
162162
await ctx.defer()
163163

164164
await ctx.respond(file=await self.create_leaderboard_image(ctx.author))

modules/lucky/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ def __init__(self, bot):
2121

2222
async def coinflip(ctx: discord.ApplicationContext):
2323
res = random.choice(['heads', 'tails'])
24-
2524
message = await ctx.respond(file=discord.File(
2625
os.path.join(self.bot.current_dir, 'images', '{}.gif'.format(res))))
2726

0 commit comments

Comments
 (0)