utils/announcements.py
async def insert(cls, ctx, announcement: str, bot_id: int, pinned: bool = False) -> typing.Union[Announcement, str]:
        """ Insert the announcement in the db. This will return an Announcement object but with the id being None,
            if successful, else, will return the error.
        """
        announcement_query = "INSERT INTO main_site_announcement (bot_id, creator_id, announcement, time, pinned) VALUES ($1, $2, $3, $4, $5) RETURNING *"
        bot_id = await _get_unique_id(ctx, "BOT", bot_id)
        author_id = await _get_unique_id(ctx, "USER", ctx.author.id)
        time = datetime.utcnow()
        try:
            return_columns = await ctx.bot.pool.fetchrow(announcement_query, bot_id, author_id, announcement, time, pinned)
            return cls(dict(return_columns))
        except Exception as err:
            return str(err)
 Insert the announcement in the db. This will return an Announcement object but with the id being None,
            if successful, else, will return the error.
        
Insert the announcement in the db. This will return an Announcement object but with the id being None,
if successful, else, will return the error.
Insert the announcement in the db . This will return an Announcement object but with the id being None if successful else will return the error .
async def insert(cls, ctx, announcement: str, bot_id: int, pinned: bool = False) -> typing.Union[Announcement, str]:
        announcement_query = "INSERT INTO main_site_announcement (bot_id, creator_id, announcement, time, pinned) VALUES ($1, $2, $3, $4, $5) RETURNING *"
        bot_id = await _get_unique_id(ctx, "BOT", bot_id)
        author_id = await _get_unique_id(ctx, "USER", ctx.author.id)
        time = datetime.utcnow()
        try:
            return_columns = await ctx.bot.pool.fetchrow(announcement_query, bot_id, author_id, announcement, time, pinned)
            return cls(dict(return_columns))
        except Exception as err:
            return str(err)
async def insert ( cls , ctx , announcement : str , bot_id : int , pinned : bool = False ) -> typing . Union [ Announcement , str ] : announcement_query = "INSERT INTO main_site_announcement (bot_id, creator_id, announcement, time, pinned) VALUES ($1, $2, $3, $4, $5) RETURNING *" bot_id = await _get_unique_id ( ctx , "BOT" , bot_id ) author_id = await _get_unique_id ( ctx , "USER" , ctx . author . id ) time = datetime . utcnow ( ) try : return_columns = await ctx . bot . pool . fetchrow ( announcement_query , bot_id , author_id , announcement , time , pinned ) return cls ( dict ( return_columns ) ) except Exception as err : return str ( err )
Insert the announcement in the db.
Insert the announcement in the db .
""" Insert the announcement in the db. This will return an Announcement object but with the id being None,
            if successful, else, will return the error.
        """
cls
ctx
announcement
str
bot_id
int
pinned
bool