appudiscordbot.py 文件源码

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

项目:Discord-Reddit-Bot 作者: appu1232 项目源码 文件源码
def edit(ctx):
    msg = '**Error** Something went wrong. Are you using the command right? Example use: ``ap:edit anime One Punch Man S2 = opm s2, one punch man s2`` to replace entire entry. Add a ``+`` or ``-`` after ``edit`` to just add or remove some keywords from entry.'
    sub = ctx.message.content.split('edit', 1)[1].strip()
    if sub:
        try:
            entry = editEntry(sub, ctx.message.author.id)
            if '=' in entry:
                await bot.send_message(ctx.message.channel, 'Successfully edited entry. Entry is now: %s. View your list with ``ap:list``.' % entry)
                await bot.send_message(discord.Object(id=config["log_location"]),
                                       'User: ' + str(ctx.message.author) + '\nCmd: ' + str(ctx.message.content))
            else:
                await bot.send_message(ctx.message.channel, '**Could not find the specified entry.**')
                await bot.send_message(discord.Object(id=config["log_location"]),
                                       'User: ' + str(ctx.message.author) + '\nCmd: ' + str(ctx.message.content))
        except:
            await bot.send_message(ctx.message.channel, '**Error** Something went wrong. Are you using the command right? Example uses: ``ap:edit + manga Boku no Hero`` For changing notifications to all threads (``-`` for episode/chapters only) or ``ap:edit manga Boku no Hero = my hero academia, boku no hero academia`` to change the entry values.')
            traceback.print_exc()

    else:
        await bot.send_message(ctx.message.channel, msg)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号