fix(rmenus): Pass guildid to role parser.
This commit is contained in:
@@ -190,7 +190,10 @@ class MenuEditor(MessageUI):
|
||||
if not userstr:
|
||||
new_data = None
|
||||
else:
|
||||
new_data = await instance._parse_string(instance.parent_id, userstr)
|
||||
new_data = await instance._parse_string(
|
||||
instance.parent_id, userstr,
|
||||
guildid=self.menu.data.guildid
|
||||
)
|
||||
instance.data = new_data
|
||||
modified.append(instance)
|
||||
if modified:
|
||||
@@ -349,7 +352,9 @@ class MenuEditor(MessageUI):
|
||||
if not userstr:
|
||||
new_data = None
|
||||
else:
|
||||
new_data = await instance._parse_string(instance.parent_id, userstr, interaction=interaction)
|
||||
new_data = await instance._parse_string(
|
||||
instance.parent_id, userstr, interaction=interaction
|
||||
)
|
||||
instance.data = new_data
|
||||
modified.append(instance)
|
||||
if modified:
|
||||
|
||||
@@ -396,7 +396,7 @@ class RoleSetting(InteractiveSetting[ParentID, int, Union[discord.Role, discord.
|
||||
if data is not None:
|
||||
role = None
|
||||
|
||||
guildid = cls._get_guildid(parent_id)
|
||||
guildid = cls._get_guildid(parent_id, **kwargs)
|
||||
bot = ctx_bot.get()
|
||||
guild = bot.get_guild(guildid)
|
||||
if guild is not None:
|
||||
@@ -409,11 +409,14 @@ class RoleSetting(InteractiveSetting[ParentID, int, Union[discord.Role, discord.
|
||||
async def _parse_string(cls, parent_id, string: str, **kwargs):
|
||||
if not string or string.lower() == 'none':
|
||||
return None
|
||||
guildid = cls._get_guildid(parent_id, **kwargs)
|
||||
|
||||
t = ctx_translator.get().t
|
||||
bot = ctx_bot.get()
|
||||
role = None
|
||||
guild = bot.get_guild(parent_id)
|
||||
guild = bot.get_guild(guildid)
|
||||
if guild is None:
|
||||
raise ValueError("Attempting to parse role string with no guild.")
|
||||
|
||||
if string.isdigit():
|
||||
maybe_id = int(string)
|
||||
|
||||
Reference in New Issue
Block a user