bot.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:YeeBot 作者: jaspric 项目源码 文件源码
def addmeme(ctx, *args, member: discord.Member = None):
    if member is None:
        member = ctx.message.author
    if args:
        if 'youtu' in args[0] or 'gfycat' in args[0] or 'imgur' in args[0] or 'streamable' in args[0] or 'redd' in args[0]:

            cur.execute("SELECT status FROM links WHERE link = ?", (args[0],))
            check = cur.fetchone()
            if check is None:
                cur.execute("INSERT INTO links (link, status, submitter_id, submitter_name) VALUES (?, 'review', ?, ?)", (args[0], member.id, member.name))
                conn.commit()
                cur.execute("SELECT count(*) FROM links WHERE status = 'review'")
                count = cur.fetchone()[0]
                if count == 1:
                    await yeebot.send_message(yeebot.get_channel(review_channel_id), 'There is 1 link awaiting review.'.format(count))
                else:
                    await yeebot.send_message(yeebot.get_channel(review_channel_id), 'There are {} links awaiting review.'.format(count))
                await yeebot.delete_message(ctx.message)
                return await yeebot.say("`{}` has been submitted for review.".format(args[0]))
            else:
                return await yeebot.say("Sorry, that link has already been submitted. It is currently in status: `{}`".format(check[0]))
        else:
            return await yeebot.say("Please only submit links from Youtube, gfycat, streamable, or imgur.")
    else:
        return await yeebot.say("Please use the format: `!addmeme https://link.to.meme/meme`")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号