Esempio n. 1
0
 async def addquote(self, ctx, message_id):
     m = await ctx.channel.fetch_message(message_id)
     if m.guild.id == ctx.guild.id:
         q = Quote()
         q.author = m.author.id
         q.message = m.content
         q.time_sent = m.created_at
         q.server = m.guild.id
         q.added_by = ctx.author.id
         highest = session.query(Quote).filter(
             Quote.server == ctx.guild.id).order_by(desc(Quote.id)).first()
         q.number = highest.number + 1 if highest else 1
         session.add(q)
         session.commit()
         await ctx.send(f'added. it\'s quote {q.number}')
Esempio n. 2
0
 async def insert_quote(cls, ctx, author, content, created_at, server_id,
                        added_by_id):
     q = Quote()
     q.author = author.id
     q.message = content
     q.time_sent = created_at
     q.server = server_id
     q.added_by = added_by_id
     highest = session.query(Quote).filter(
         Quote.server == ctx.guild.id).order_by(desc(Quote.id)).first()
     q.number = highest.number + 1 if highest else 1
     session.add(q)
     session.commit()
     await ctx.send(
         f'added. it\'s quote {q.number}\n"{q.message}"\n—{author.name} (Quote #{q.number})'
     )