mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
[V3 Core] Fix error on [p]set command when used in DM (#1748)
* issue #1741 fix * requested changes
This commit is contained in:
parent
34bd5ead15
commit
9f0e752318
@ -515,28 +515,25 @@ class Core:
|
||||
async def _set(self, ctx):
|
||||
"""Changes Red's settings"""
|
||||
if ctx.invoked_subcommand is None:
|
||||
if ctx.guild:
|
||||
admin_role_id = await ctx.bot.db.guild(ctx.guild).admin_role()
|
||||
admin_role = discord.utils.get(ctx.guild.roles, id=admin_role_id)
|
||||
admin_role = discord.utils.get(ctx.guild.roles, id=admin_role_id) or "Not set"
|
||||
mod_role_id = await ctx.bot.db.guild(ctx.guild).mod_role()
|
||||
mod_role = discord.utils.get(ctx.guild.roles, id=mod_role_id)
|
||||
mod_role = discord.utils.get(ctx.guild.roles, id=mod_role_id) or "Not set"
|
||||
prefixes = await ctx.bot.db.guild(ctx.guild).prefix()
|
||||
guild_settings = f"Admin role: {admin_role}\nMod role: {mod_role}\n"
|
||||
else:
|
||||
guild_settings = ""
|
||||
if not prefixes:
|
||||
prefixes = await ctx.bot.db.prefix()
|
||||
locale = await ctx.bot.db.locale()
|
||||
|
||||
prefix_string = " ".join(prefixes)
|
||||
settings = (
|
||||
"{} Settings:\n\n"
|
||||
"Prefixes: {}\n"
|
||||
"Admin role: {}\n"
|
||||
"Mod role: {}\n"
|
||||
"Locale: {}"
|
||||
"".format(
|
||||
ctx.bot.user.name,
|
||||
" ".join(prefixes),
|
||||
admin_role.name if admin_role else "Not set",
|
||||
mod_role.name if mod_role else "Not set",
|
||||
locale,
|
||||
)
|
||||
f"{ctx.bot.user.name} Settings:\n\n"
|
||||
f"Prefixes: {prefix_string}\n"
|
||||
f"{guild_settings}"
|
||||
f"Locale: {locale}"
|
||||
)
|
||||
await ctx.send(box(settings))
|
||||
await ctx.send_help()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user