NAFF updated to version 2.1.0

This commit is contained in:
Vegard Berg 2023-02-01 19:16:35 +01:00
parent a64f6c6003
commit f3c6aa9f85
5 changed files with 677 additions and 661 deletions

View File

@ -351,9 +351,9 @@ class Gatekeep(Extension):
), ),
) )
@listen(events.Button) @listen(events.ButtonPressed)
async def on_regenerate_button(self, button: events.Button): async def on_regenerate_button(self, button: events.ButtonPressed):
ctx = button.context ctx = button.ctx
member = ctx.author member = ctx.author
if ( if (

View File

@ -308,9 +308,9 @@ class Polls(Extension):
poll_entry.channel_id = poll_message.channel.id poll_entry.channel_id = poll_message.channel.id
poll_entry.save() poll_entry.save()
@listen(events.Button) @listen(events.ButtonPressed)
async def on_button(self, button: events.Button): #pylint: disable=too-many-branches,too-many-statements async def on_button(self, button: events.ButtonPressed): #pylint: disable=too-many-branches,too-many-statements
ctx = button.context ctx = button.ctx
# Ensure that the pressed button is a vote button. # Ensure that the pressed button is a vote button.
if ctx.custom_id.startswith("poll-vote:"): if ctx.custom_id.startswith("poll-vote:"):

View File

@ -12,7 +12,7 @@ from naff import (
Role, Role,
Embed, Embed,
AutocompleteContext, AutocompleteContext,
Select, StringSelectMenu,
SelectOption, SelectOption,
listen, listen,
context_menu, context_menu,
@ -436,7 +436,7 @@ class SelfRoles(Extension):
max_vals = 1 if group_q.exclusive else len(options) max_vals = 1 if group_q.exclusive else len(options)
select = Select( select = StringSelectMenu(
options=options, options=options,
placeholder=f"Select roles from the group {group}", placeholder=f"Select roles from the group {group}",
custom_id=f"role-group-assign:{group}", custom_id=f"role-group-assign:{group}",
@ -552,7 +552,7 @@ class SelfRoles(Extension):
or msg.embeds[0].title is None or msg.embeds[0].title is None
or len(msg.components) < 1 or len(msg.components) < 1
or len(msg.components[0].components) < 1 or len(msg.components[0].components) < 1
or not isinstance(msg.components[0].components[0], Select) or not isinstance(msg.components[0].components[0], StringSelectMenu)
or not msg.components[0].components[0].custom_id.startswith("role-group-assign") or not msg.components[0].components[0].custom_id.startswith("role-group-assign")
): ):
await ctx.send("Could not identify this as a role-group message!", ephemeral=True) await ctx.send("Could not identify this as a role-group message!", ephemeral=True)
@ -600,7 +600,7 @@ class SelfRoles(Extension):
max_vals = 1 if group_q.exclusive else len(options) max_vals = 1 if group_q.exclusive else len(options)
select = Select( select = StringSelectMenu(
options=options, options=options,
placeholder=f"Select roles from the group {group}", placeholder=f"Select roles from the group {group}",
custom_id=f"role-group-assign:{group}", custom_id=f"role-group-assign:{group}",

1316
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -10,7 +10,7 @@ heimdallr = "heimdallr.Heimdallr:main"
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.10" python = "^3.10"
peewee = "^3.15.1" peewee = "^3.15.1"
naff = "^1.11.1" naff = "2.1.0"
orjson = "^3.7.8" orjson = "^3.7.8"
python-dotenv = "^0.20.0" python-dotenv = "^0.20.0"
captcha = "^0.4" captcha = "^0.4"