Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 我的webhook脚本中的message\member有问题_Python_Python 3.x_Discord_Webhooks_Discord.py - Fatal编程技术网

Python 我的webhook脚本中的message\member有问题

Python 我的webhook脚本中的message\member有问题,python,python-3.x,discord,webhooks,discord.py,Python,Python 3.x,Discord,Webhooks,Discord.py,我已经为聊天服务编写了一个python脚本 执行脚本时,收到以下错误: raise TypeError(类型为{o.class.name}的对象) TypeError:消息类型的对象不可JSON序列化 我无法解决此问题。以下是我正在使用的代码 import discord from discord.ext import commands import random from discord.ext.commands import Bot import asyncio import time im

我已经为聊天服务编写了一个python脚本

执行脚本时,收到以下错误:

raise TypeError(类型为{o.class.name}的对象) TypeError:消息类型的对象不可JSON序列化

我无法解决此问题。以下是我正在使用的代码

import discord
from discord.ext import commands
import random
from discord.ext.commands import Bot
import asyncio
import time
import logging
import http.client
import aiml
import asyncio
from datetime import datetime, timedelta
import os
import pkg_resources
import logging
import logging.config
import sqlite3
import youtube_dl as ytdl
from discord_webhook import DiscordWebhook, DiscordEmbed
import time
import aiohttp
import importlib
import sys
import client

bot = commands.Bot(command_prefix='!', description=description)

@bot.event
async def on_ready():
    print('Logged in as')
    print(bot.user.name)
    print(bot.user.id)
    print('------')
    await bot.change_presence(status=discord.Status.idle, activity=discord.Game('robie placki z Ufoludem (prefix?!)'))

webhook_urls = ['url1', 'url2']



@bot.event
async def on_message(message):
    channels = [":arrow_lower_right:globalny:arrow_lower_left:"]
    for word in channels:
            await message.delete()
            response = DiscordWebhook(url=webhook_urls, content=message).execute()

请让我知道我哪里出了问题。当前遇到此问题。有任何解决此问题的建议吗?

message
是一个
message
对象,
message。content
是您要查找的字符串

response = DiscordWebhook(url=webhook_urls, content=message.content).execute()