属性错误: '_io.TextIOWrapper'对象没有属性'fp'



当我试图将txt文件发送到discord-webhook时,会出现此错误。(蟒蛇3(

import os
import subprocess
import requests
import discord
import dhooks
from dhooks import Webhook, Embed
hook = Webhook("hook")
Discord_txt = open("data.txt", "r+")
hook.send(file=Discord_txt)

根据文档,您应该使用dhooks:中的File

from dhooks import Webhook, File
hook = Webhook("https://discord.com/api/webhooks/...")
Discord_txt = File("data.txt")
hook.send(file=Discord_txt)

相关内容

  • 没有找到相关文章