[英]discord.py how to check server link
我制作 discord 機器人。 如何檢查用戶消息中是否存在服務器鏈接?
我寫代碼:
.... skip
@bot.event
async def on_message():
if message.content in 'https://discord.gg':
await message.delete()
你做錯了,你應該檢查 substring 是否在字符串中,而不是相反。 嘗試這個:
if "discord.gg/" in message.content:
message.delete()
我使用discord.gg/
在沒有 https 的情況下捕獲消息。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.