mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-08 20:28:55 -05:00
[Core] Make bot name adjustable in bot. (#3429)
* First draft * Up for discussion * Revert "Up for discussion" This reverts commit 2f00b7ded8c0d03a7a06b7b973438cbd87d1f447.
This commit is contained in:
parent
e1a110b1bf
commit
8570971f68
@ -358,7 +358,7 @@ class Core(commands.Cog, CoreLogic):
|
|||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
async def uptime(self, ctx: commands.Context):
|
async def uptime(self, ctx: commands.Context):
|
||||||
"""Shows Red's uptime"""
|
"""Shows [botname]'s uptime"""
|
||||||
since = ctx.bot.uptime.strftime("%Y-%m-%d %H:%M:%S")
|
since = ctx.bot.uptime.strftime("%Y-%m-%d %H:%M:%S")
|
||||||
delta = datetime.datetime.utcnow() - self.bot.uptime
|
delta = datetime.datetime.utcnow() - self.bot.uptime
|
||||||
uptime_str = humanize_timedelta(timedelta=delta) or _("Less than one second")
|
uptime_str = humanize_timedelta(timedelta=delta) or _("Less than one second")
|
||||||
@ -471,7 +471,7 @@ class Core(commands.Cog, CoreLogic):
|
|||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.check(CoreLogic._can_get_invite_url)
|
@commands.check(CoreLogic._can_get_invite_url)
|
||||||
async def invite(self, ctx):
|
async def invite(self, ctx):
|
||||||
"""Show's Red's invite url"""
|
"""Show's [botname]'s invite url"""
|
||||||
try:
|
try:
|
||||||
await ctx.author.send(await self._invite_url())
|
await ctx.author.send(await self._invite_url())
|
||||||
except discord.errors.Forbidden:
|
except discord.errors.Forbidden:
|
||||||
@ -834,7 +834,7 @@ class Core(commands.Cog, CoreLogic):
|
|||||||
|
|
||||||
@commands.group(name="set")
|
@commands.group(name="set")
|
||||||
async def _set(self, ctx: commands.Context):
|
async def _set(self, ctx: commands.Context):
|
||||||
"""Changes Red's settings"""
|
"""Changes [botname]'s settings"""
|
||||||
if ctx.invoked_subcommand is None:
|
if ctx.invoked_subcommand is None:
|
||||||
if ctx.guild:
|
if ctx.guild:
|
||||||
guild = ctx.guild
|
guild = ctx.guild
|
||||||
@ -1020,7 +1020,7 @@ class Core(commands.Cog, CoreLogic):
|
|||||||
@_set.command()
|
@_set.command()
|
||||||
@checks.is_owner()
|
@checks.is_owner()
|
||||||
async def avatar(self, ctx: commands.Context, url: str):
|
async def avatar(self, ctx: commands.Context, url: str):
|
||||||
"""Sets Red's avatar"""
|
"""Sets [botname]'s avatar"""
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession() as session:
|
||||||
async with session.get(url) as r:
|
async with session.get(url) as r:
|
||||||
data = await r.read()
|
data = await r.read()
|
||||||
@ -1044,7 +1044,7 @@ class Core(commands.Cog, CoreLogic):
|
|||||||
@checks.bot_in_a_guild()
|
@checks.bot_in_a_guild()
|
||||||
@checks.is_owner()
|
@checks.is_owner()
|
||||||
async def _game(self, ctx: commands.Context, *, game: str = None):
|
async def _game(self, ctx: commands.Context, *, game: str = None):
|
||||||
"""Sets Red's playing status"""
|
"""Sets [botname]'s playing status"""
|
||||||
|
|
||||||
if game:
|
if game:
|
||||||
game = discord.Game(name=game)
|
game = discord.Game(name=game)
|
||||||
@ -1058,7 +1058,7 @@ class Core(commands.Cog, CoreLogic):
|
|||||||
@checks.bot_in_a_guild()
|
@checks.bot_in_a_guild()
|
||||||
@checks.is_owner()
|
@checks.is_owner()
|
||||||
async def _listening(self, ctx: commands.Context, *, listening: str = None):
|
async def _listening(self, ctx: commands.Context, *, listening: str = None):
|
||||||
"""Sets Red's listening status"""
|
"""Sets [botname]'s listening status"""
|
||||||
|
|
||||||
status = ctx.bot.guilds[0].me.status if len(ctx.bot.guilds) > 0 else discord.Status.online
|
status = ctx.bot.guilds[0].me.status if len(ctx.bot.guilds) > 0 else discord.Status.online
|
||||||
if listening:
|
if listening:
|
||||||
@ -1072,7 +1072,7 @@ class Core(commands.Cog, CoreLogic):
|
|||||||
@checks.bot_in_a_guild()
|
@checks.bot_in_a_guild()
|
||||||
@checks.is_owner()
|
@checks.is_owner()
|
||||||
async def _watching(self, ctx: commands.Context, *, watching: str = None):
|
async def _watching(self, ctx: commands.Context, *, watching: str = None):
|
||||||
"""Sets Red's watching status"""
|
"""Sets [botname]'s watching status"""
|
||||||
|
|
||||||
status = ctx.bot.guilds[0].me.status if len(ctx.bot.guilds) > 0 else discord.Status.online
|
status = ctx.bot.guilds[0].me.status if len(ctx.bot.guilds) > 0 else discord.Status.online
|
||||||
if watching:
|
if watching:
|
||||||
@ -1086,7 +1086,7 @@ class Core(commands.Cog, CoreLogic):
|
|||||||
@checks.bot_in_a_guild()
|
@checks.bot_in_a_guild()
|
||||||
@checks.is_owner()
|
@checks.is_owner()
|
||||||
async def status(self, ctx: commands.Context, *, status: str):
|
async def status(self, ctx: commands.Context, *, status: str):
|
||||||
"""Sets Red's status
|
"""Sets [botname]'s status
|
||||||
|
|
||||||
Available statuses:
|
Available statuses:
|
||||||
online
|
online
|
||||||
@ -1115,7 +1115,7 @@ class Core(commands.Cog, CoreLogic):
|
|||||||
@checks.bot_in_a_guild()
|
@checks.bot_in_a_guild()
|
||||||
@checks.is_owner()
|
@checks.is_owner()
|
||||||
async def stream(self, ctx: commands.Context, streamer=None, *, stream_title=None):
|
async def stream(self, ctx: commands.Context, streamer=None, *, stream_title=None):
|
||||||
"""Sets Red's streaming status
|
"""Sets [botname]'s streaming status
|
||||||
Leaving both streamer and stream_title empty will clear it."""
|
Leaving both streamer and stream_title empty will clear it."""
|
||||||
|
|
||||||
status = ctx.bot.guilds[0].me.status if len(ctx.bot.guilds) > 0 else None
|
status = ctx.bot.guilds[0].me.status if len(ctx.bot.guilds) > 0 else None
|
||||||
@ -1136,7 +1136,7 @@ class Core(commands.Cog, CoreLogic):
|
|||||||
@_set.command(name="username", aliases=["name"])
|
@_set.command(name="username", aliases=["name"])
|
||||||
@checks.is_owner()
|
@checks.is_owner()
|
||||||
async def _username(self, ctx: commands.Context, *, username: str):
|
async def _username(self, ctx: commands.Context, *, username: str):
|
||||||
"""Sets Red's username"""
|
"""Sets [botname]'s username"""
|
||||||
try:
|
try:
|
||||||
await self._name(name=username)
|
await self._name(name=username)
|
||||||
except discord.HTTPException:
|
except discord.HTTPException:
|
||||||
@ -1155,7 +1155,7 @@ class Core(commands.Cog, CoreLogic):
|
|||||||
@checks.admin()
|
@checks.admin()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def _nickname(self, ctx: commands.Context, *, nickname: str = None):
|
async def _nickname(self, ctx: commands.Context, *, nickname: str = None):
|
||||||
"""Sets Red's nickname"""
|
"""Sets [botname]'s nickname"""
|
||||||
try:
|
try:
|
||||||
await ctx.guild.me.edit(nick=nickname)
|
await ctx.guild.me.edit(nick=nickname)
|
||||||
except discord.Forbidden:
|
except discord.Forbidden:
|
||||||
@ -1166,7 +1166,7 @@ class Core(commands.Cog, CoreLogic):
|
|||||||
@_set.command(aliases=["prefixes"])
|
@_set.command(aliases=["prefixes"])
|
||||||
@checks.is_owner()
|
@checks.is_owner()
|
||||||
async def prefix(self, ctx: commands.Context, *prefixes: str):
|
async def prefix(self, ctx: commands.Context, *prefixes: str):
|
||||||
"""Sets Red's global prefix(es)"""
|
"""Sets [botname]'s global prefix(es)"""
|
||||||
if not prefixes:
|
if not prefixes:
|
||||||
await ctx.send_help()
|
await ctx.send_help()
|
||||||
return
|
return
|
||||||
@ -1177,7 +1177,7 @@ class Core(commands.Cog, CoreLogic):
|
|||||||
@checks.admin()
|
@checks.admin()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def serverprefix(self, ctx: commands.Context, *prefixes: str):
|
async def serverprefix(self, ctx: commands.Context, *prefixes: str):
|
||||||
"""Sets Red's server prefix(es)"""
|
"""Sets [botname]'s server prefix(es)"""
|
||||||
if not prefixes:
|
if not prefixes:
|
||||||
await ctx.bot._prefix_cache.set_prefixes(guild=ctx.guild, prefixes=[])
|
await ctx.bot._prefix_cache.set_prefixes(guild=ctx.guild, prefixes=[])
|
||||||
await ctx.send(_("Guild prefixes have been reset."))
|
await ctx.send(_("Guild prefixes have been reset."))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user