不和谐票机器人

Peeyush Kumar

解决问题后,从客户端创建票证后,如何保存该聊天记录以作进一步证明,甚至将副本发送给客户端?1.成绩单的使用。2.将消息另存为html格式3.使用节点js语言

他们看到

我不确定html部分,但这是我个人用来将任意数量的邮件保存在.txt文件中的通道中的代码- (discord.py rewrite v1.4.1)

@client.command(aliases=['transcript', 'save'])
@commands.has_permissions(administrator=True)
async def history(ctx, limit: int = 100):
    channel = ctx.message.channel
    messages = await ctx.channel.history(limit=limit).flatten()

    with open(f"{channel}_messages.txt", "a+", encoding="utf-8") as f:
        print(f"\nTranscript Saved by - {ctx.author.display_name}.\n\n", file=f)
        for message in messages:
            embed = ""
            if len(message.embeds) != 0:
                embed = message.embeds[0].description
                print(f"{message.author.name} - {embed}", file=f)
            print(f"{message.author.name} - {message.content}", file=f)
    await ctx.message.add_reaction("✅")
    await ctx.send(f"{ctx.author.mention}, Transcript saved.")
    history = discord.File(fp=f'{channel}_messages.txt', filename=None)
    await ctx.send(file=history)

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章