mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-08 04:08:56 -05:00
[V3] Add settings displays to [p]set and [p]bankset (#1475)
This commit is contained in:
parent
d9c71bddb8
commit
772590c41c
@ -1,4 +1,5 @@
|
|||||||
import discord
|
import discord
|
||||||
|
from redbot.core.utils.chat_formatting import box
|
||||||
|
|
||||||
from redbot.core import checks, bank
|
from redbot.core import checks, bank
|
||||||
from redbot.core.i18n import CogI18n
|
from redbot.core.i18n import CogI18n
|
||||||
@ -60,6 +61,26 @@ class Bank:
|
|||||||
async def bankset(self, ctx: commands.Context):
|
async def bankset(self, ctx: commands.Context):
|
||||||
"""Base command for bank settings"""
|
"""Base command for bank settings"""
|
||||||
if ctx.invoked_subcommand is None:
|
if ctx.invoked_subcommand is None:
|
||||||
|
if await bank.is_global():
|
||||||
|
bank_name = await bank._conf.bank_name()
|
||||||
|
currency_name = await bank._conf.currency()
|
||||||
|
default_balance = await bank._conf.default_balance()
|
||||||
|
else:
|
||||||
|
if not ctx.guild:
|
||||||
|
await ctx.send_help()
|
||||||
|
return
|
||||||
|
bank_name = await bank._conf.guild(ctx.guild).bank_name()
|
||||||
|
currency_name = await bank._conf.guild(ctx.guild).currency()
|
||||||
|
default_balance = await bank._conf.guild(ctx.guild).default_balance()
|
||||||
|
|
||||||
|
settings = (_(
|
||||||
|
"Bank settings:\n\n"
|
||||||
|
"Bank name: {}\n"
|
||||||
|
"Currency: {}\n"
|
||||||
|
"Default balance: {}"
|
||||||
|
"").format(bank_name, currency_name, default_balance)
|
||||||
|
)
|
||||||
|
await ctx.send(box(settings))
|
||||||
await ctx.send_help()
|
await ctx.send_help()
|
||||||
|
|
||||||
@bankset.command(name="toggleglobal")
|
@bankset.command(name="toggleglobal")
|
||||||
|
|||||||
@ -144,6 +144,15 @@ class Core:
|
|||||||
use embeds.
|
use embeds.
|
||||||
"""
|
"""
|
||||||
if ctx.invoked_subcommand is None:
|
if ctx.invoked_subcommand is None:
|
||||||
|
text = "Embed settings:\n\n"
|
||||||
|
global_default = await self.bot.db.embeds()
|
||||||
|
text += "Global default: {}\n".format(global_default)
|
||||||
|
if ctx.guild:
|
||||||
|
guild_setting = await self.bot.db.guild(ctx.guild).embeds()
|
||||||
|
text += "Guild setting: {}\n".format(guild_setting)
|
||||||
|
user_setting = await self.bot.db.user(ctx.author).embeds()
|
||||||
|
text += "User setting: {}".format(user_setting)
|
||||||
|
await ctx.send(box(text))
|
||||||
await ctx.send_help()
|
await ctx.send_help()
|
||||||
|
|
||||||
@embedset.command(name="global")
|
@embedset.command(name="global")
|
||||||
@ -517,6 +526,27 @@ class Core:
|
|||||||
async def _set(self, ctx):
|
async def _set(self, ctx):
|
||||||
"""Changes Red's settings"""
|
"""Changes Red's settings"""
|
||||||
if ctx.invoked_subcommand is None:
|
if ctx.invoked_subcommand is None:
|
||||||
|
admin_role_id = await ctx.bot.db.guild(ctx.guild).admin_role()
|
||||||
|
admin_role = discord.utils.get(ctx.guild.roles, id=admin_role_id)
|
||||||
|
mod_role_id = await ctx.bot.db.guild(ctx.guild).mod_role()
|
||||||
|
mod_role = discord.utils.get(ctx.guild.roles, id=mod_role_id)
|
||||||
|
prefixes = await ctx.bot.db.guild(ctx.guild).prefix()
|
||||||
|
if not prefixes:
|
||||||
|
prefixes = await ctx.bot.db.prefix()
|
||||||
|
locale = await ctx.bot.db.locale()
|
||||||
|
|
||||||
|
settings = (
|
||||||
|
"{} Settings:\n\n"
|
||||||
|
"Prefixes: {}\n"
|
||||||
|
"Admin role: {}\n"
|
||||||
|
"Mod role: {}\n"
|
||||||
|
"Locale: {}"
|
||||||
|
"".format(
|
||||||
|
ctx.bot.user.name, " ".join(prefixes),
|
||||||
|
admin_role.name, mod_role.name, locale
|
||||||
|
)
|
||||||
|
)
|
||||||
|
await ctx.send(box(settings))
|
||||||
await ctx.send_help()
|
await ctx.send_help()
|
||||||
|
|
||||||
@_set.command()
|
@_set.command()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user