mirror of
https://github.com/Ryujinx/ryuko-ng.git
synced 2024-06-03 00:58:53 +02:00
Compare commits
3 Commits
efb041f696
...
2bb287db29
Author | SHA1 | Date | |
---|---|---|---|
|
2bb287db29 | ||
|
ac3829f508 | ||
|
b2cda3fe85 |
|
@ -39,8 +39,15 @@ class Remind(Cog):
|
||||||
@commands.command(aliases=["remindme"])
|
@commands.command(aliases=["remindme"])
|
||||||
async def remind(self, ctx, when: str, *, text: str = "something"):
|
async def remind(self, ctx, when: str, *, text: str = "something"):
|
||||||
"""Reminds you about something."""
|
"""Reminds you about something."""
|
||||||
|
ref_message = None
|
||||||
|
if ctx.message.reference is not None:
|
||||||
|
ref_message = await ctx.channel.fetch_message(
|
||||||
|
ctx.message.reference.message_id
|
||||||
|
)
|
||||||
|
|
||||||
if ctx.guild:
|
if ctx.guild:
|
||||||
await ctx.message.delete()
|
await ctx.message.delete()
|
||||||
|
|
||||||
current_timestamp = time.time()
|
current_timestamp = time.time()
|
||||||
expiry_timestamp = self.bot.parse_time(when)
|
expiry_timestamp = self.bot.parse_time(when)
|
||||||
|
|
||||||
|
@ -58,6 +65,9 @@ class Remind(Cog):
|
||||||
)
|
)
|
||||||
|
|
||||||
safe_text = await commands.clean_content().convert(ctx, str(text))
|
safe_text = await commands.clean_content().convert(ctx, str(text))
|
||||||
|
if ref_message is not None:
|
||||||
|
safe_text += f"\nMessage reference: {ref_message.jump_url}"
|
||||||
|
|
||||||
added_on = datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S (UTC)")
|
added_on = datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S (UTC)")
|
||||||
|
|
||||||
add_job(
|
add_job(
|
||||||
|
@ -68,12 +78,10 @@ class Remind(Cog):
|
||||||
expiry_timestamp,
|
expiry_timestamp,
|
||||||
)
|
)
|
||||||
|
|
||||||
msg = await ctx.send(
|
await ctx.send(
|
||||||
f"{ctx.author.mention}: I'll remind you in "
|
f"{ctx.author.mention}: I'll remind you in "
|
||||||
f"DMs about `{safe_text}` in {duration_text}."
|
f"DMs about `{safe_text}` in {duration_text}."
|
||||||
)
|
)
|
||||||
await asyncio.sleep(5)
|
|
||||||
await msg.delete()
|
|
||||||
|
|
||||||
|
|
||||||
async def setup(bot):
|
async def setup(bot):
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from discord import Guild
|
from discord import Guild
|
||||||
|
from discord.errors import Forbidden
|
||||||
from discord.ext import tasks
|
from discord.ext import tasks
|
||||||
from discord.ext.commands import Cog
|
from discord.ext.commands import Cog
|
||||||
|
|
||||||
|
@ -14,9 +15,14 @@ class VanityUrl(Cog):
|
||||||
|
|
||||||
async def update_vanity_code(self, guild: Guild, code: str):
|
async def update_vanity_code(self, guild: Guild, code: str):
|
||||||
if "VANITY_URL" in guild.features and guild.vanity_url_code != code:
|
if "VANITY_URL" in guild.features and guild.vanity_url_code != code:
|
||||||
await guild.edit(
|
try:
|
||||||
reason="Configured vanity code was different", vanity_code=code
|
await guild.edit(
|
||||||
)
|
reason="Configured vanity code was different", vanity_code=code
|
||||||
|
)
|
||||||
|
except Forbidden:
|
||||||
|
self.bot.log.exception(f"Not allowed to edit vanity url for: {guild}")
|
||||||
|
self.cog_unload()
|
||||||
|
await self.bot.unload_extension("robocop_ng.cogs.vanity_url")
|
||||||
|
|
||||||
@Cog.listener()
|
@Cog.listener()
|
||||||
async def on_guild_update(self, before: Guild, after: Guild):
|
async def on_guild_update(self, before: Guild, after: Guild):
|
||||||
|
|
|
@ -38,7 +38,6 @@ initial_cogs = [
|
||||||
"cogs.links",
|
"cogs.links",
|
||||||
"cogs.remind",
|
"cogs.remind",
|
||||||
"cogs.robocronp",
|
"cogs.robocronp",
|
||||||
"cogs.vanity_url",
|
|
||||||
"cogs.meme",
|
"cogs.meme",
|
||||||
"cogs.invites",
|
"cogs.invites",
|
||||||
"cogs.yubicootp",
|
"cogs.yubicootp",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user