adapter-discord
adapter-discord copied to clipboard
机器人在频道无法使用
机器人开了所有权限,邀请进服务器后,在channels 输入文本消息,机器人无法获取到信息
'_message': [TextSegment(type='text', data={'text': ''})],
刚经测试,如果消息不@Bot的话,Bot收到的消息为空,@Bot了才收到正常的消息,目前不知道是不是 Discord 改动了什么权限。
我今天@bot也收不到消息
有没有在 Bot 的设置里打开 MESSAGE CONTENT INTENT
我不@bot也能收到 content ,不过有时又不行。🤔
log
04-19 11:03:49 [SUCCESS] nonebot | Discord 1208326638673330196 | [GuildMessageCreateEvent]: {'id': 1230715459167453247, 'channel_id': 1208348399263285308, 'author': {'id': 474564749217234954, 'username': 'autuamn_end', 'discriminator': '0', 'global_name': 'Autuamn End', 'avatar': '7a8c1eacb63acfd711543f86244e5572', 'bot': <UNSET>, 'system': <UNSET>, 'mfa_enabled': <UNSET>, 'banner': <UNSET>, 'accent_color': <UNSET>, 'locale': <UNSET>, 'verified': <UNSET>, 'email': <UNSET>, 'flags': <UNSET>, 'premium_type': <UNSET>, 'public_flags': <UserFlags: 0>, 'avatar_decoration': <UNSET>}, 'content': '1股份6njfgh', 'timestamp': datetime.datetime(2024, 4, 19, 3, 3, 51, 53000, tzinfo=TzInfo(UTC)), 'edited_timestamp': None, 'tts': False, 'mention_everyone': False, 'mentions': [], 'mention_roles': [], 'mention_channels': <UNSET>, 'attachments': [], 'embeds': [], 'reactions': <UNSET>, 'nonce': '1230715449038077952', 'pinned': False, 'webhook_id': <UNSET>, 'type': <MessageType.DEFAULT: 0>, 'activity': <UNSET>, 'application': <UNSET>, 'application_id': <UNSET>, 'message_reference': <UNSET>, 'flags': <MessageFlag: 0>, 'referenced_message': None, 'interaction': <UNSET>, 'thread': <UNSET>, 'components': [], 'sticker_items': <UNSET>, 'stickers': <UNSET>, 'position': <UNSET>, 'role_subscription_data': <UNSET>, 'guild_id': 1171294052839333910, 'member': {'user': <UNSET>, 'nick': None, 'avatar': None, 'roles': [1180878026678993048, 1181071825208360960, 1181071750851727442, 1180870446959296533], 'joined_at': datetime.datetime(2023, 11, 7, 3, 44, 23, 842000, tzinfo=TzInfo(UTC)), 'premium_since': None, 'deaf': False, 'mute': False, 'flags': <GuildMemberFlags.COMPLETED_ONBOARDING: 2>, 'pending': False, 'permissions': <UNSET>, 'communication_disabled_until': None}, 'to_me': False, 'reply': None}
我也是这样,intent都开了,大部分时候都是必须@才能收到内容,不然content就是空的
测试了一下,可能是机器人必须有缓存才能收到,在刚开启Presence Update这个intent之后,就可以不@就能收到内容,然后重启机器人程序之后就不行了
"message_content": true 在配置文件里监听里面加上这一句!整得我都麻了,只有at才能收到信息,加了这一条以后就治好了。