From bb42badf972465595babc988154c9adbda19183b Mon Sep 17 00:00:00 2001 From: rtk-rnjn Date: Sat, 9 Sep 2023 12:17:39 +0530 Subject: [PATCH] fix duplication error --- cogs/rss/__init__.py | 9 +++++++++ cogs/rss/rss.py | 36 ++++++++++++++++++++++++++++++++++++ core/Parrot.py | 4 ++-- 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 cogs/rss/__init__.py create mode 100644 cogs/rss/rss.py diff --git a/cogs/rss/__init__.py b/cogs/rss/__init__.py new file mode 100644 index 00000000..053bcc19 --- /dev/null +++ b/cogs/rss/__init__.py @@ -0,0 +1,9 @@ +from __future__ import annotations + +from core import Parrot + +from .rss import RSS + + +async def setup(bot: Parrot) -> None: + await bot.add_cog(RSS(bot)) diff --git a/cogs/rss/rss.py b/cogs/rss/rss.py new file mode 100644 index 00000000..9e8d60e3 --- /dev/null +++ b/cogs/rss/rss.py @@ -0,0 +1,36 @@ +from __future__ import annotations + +from core import Parrot, Context, Cog +from discord.ext import commands, tasks +import discord + + +class RSS(Cog): + def __init__(self, bot: Parrot) -> None: + self.bot = bot + + @commands.group(name="rss", aliases=["rssfeed"]) + @commands.has_permissions(manage_guild=True) + async def rss(self, ctx: Context) -> None: + """RSS Feed Management""" + if ctx.invoked_subcommand is None: + await ctx.send_help(ctx.command) + + @rss.command(name="add") + async def rss_add(self, ctx: Context, *, link: str) -> None: + """Add a new RSS Feed""" + pass + + @rss.command(name="remove") + async def rss_remove(self, ctx: Context, *, link: str) -> None: + """Remove an existing RSS Feed""" + pass + + @rss.command(name="list") + async def rss_list(self, ctx: Context, *, link: str) -> None: + """List all RSS Feeds""" + pass + + @tasks.loop(count=1) + async def rss_loop(self) -> None: + pass diff --git a/core/Parrot.py b/core/Parrot.py index 52aec2bd..5572e421 100644 --- a/core/Parrot.py +++ b/core/Parrot.py @@ -1133,7 +1133,7 @@ async def create_timer( # fmt: off post = { - "_id": message.id if isinstance(message, discord.Message) else message, + "_id": (message.id if isinstance(message, discord.Message) else message) or discord.utils.utcnow().timestamp() * 1000, "_event_name": _event_name, "expires_at": expires_at, "created_at": ( @@ -1571,7 +1571,7 @@ async def wait_and_delete( timestamp: float | None = None, channel_id: int | None = None, message_id: int | None = None, - message: discord.Message | None = None, + message: discord.Message = None, ) -> None: if message and delay: await message.delete(delay=delay)