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