Discord.py 无法向正确的用户发送消息

时间:2021-05-04 12:12:36

标签: python discord discord.py bots

好的,所以我做了一个 modmail bot,以防你们不知道 modmail bot 是什么 基本上,我服务器中的用户可以将其作为票证发送消息,我的团队成员会做出回应。 它有一个关闭功能,当我在管理聊天工单中关闭而不是关闭它时,我无法修复它,而是在向制作工单的用户发送消息时,它最初是 dming 我,但现在它是 dming no一。我需要帮助修复它。

{
    "op" : "query",
    "ns" : "db.runs",
    "command" : {
        "find" : "runs",
        "filter" : {
            "ts_start" : {
                "$gte" : ISODate("2018-01-01T23:00:00.000Z")
            },
            "ts_end" : {
                "$lte" : ISODate("2018-01-01T23:59:59.000Z")
            }
        },
        "limit" : 81,
        "comment" : "MyQuery",
        "$db" : "db",
        "lsid" : {
            "id" : UUID("562115f5-059d-441a-96ad-e9da6702c962")
        }
    },
    "keysExamined" : 248196,
    "docsExamined" : 248196,
    "fromMultiPlanner" : true,
    "replanned" : true,
    "replanReason" : "cached plan was less efficient than expected: expected trial execution to take 81 works but it took at least 810 works",
    "cursorExhausted" : true,
    "numYield" : 73223,
    "nreturned" : 80,
    "queryHash" : "8927FA09",
    "planCacheKey" : "EFB63FF1",
    "locks" : {
        "ParallelBatchWriterMode" : {
            "acquireCount" : {
                "r" : NumberLong(1)
            }
        },
        "ReplicationStateTransition" : {
            "acquireCount" : {
                "w" : NumberLong(73225)
            }
        },
        "Global" : {
            "acquireCount" : {
                "r" : NumberLong(73225)
            }
        },
        "Database" : {
            "acquireCount" : {
                "r" : NumberLong(73224)
            }
        },
        "Collection" : {
            "acquireCount" : {
                "r" : NumberLong(73224)
            }
        },
        "Mutex" : {
            "acquireCount" : {
                "r" : NumberLong(1)
            }
        }
    },
    "flowControl" : {},
    "storage" : {
        "data" : {
            "bytesRead" : NumberLong(37794055022),
            "timeReadingMicros" : NumberLong(1394728348)
        }
    },
    "responseLength" : 4283172,
    "protocol" : "op_msg",
    "millis" : 1418283,
    "planSummary" : "IXSCAN { ts_end: 1 }",
    "execStats" : {
        "stage" : "LIMIT",
        "nReturned" : 80,
        "executionTimeMillisEstimate" : 500618,
        "works" : 248197,
        "advanced" : 80,
        "needTime" : 248116,
        "needYield" : 0,
        "saveState" : 73217,
        "restoreState" : 73217,
        "isEOF" : 1,
        "limitAmount" : 81,
        "inputStage" : {
            "stage" : "FETCH",
            "filter" : {
                "ts_start" : {
                    "$gte" : ISODate("2018-01-01T23:00:00.000Z")
                }
            },
            "nReturned" : 80,
            "executionTimeMillisEstimate" : 500574,
            "works" : 248197,
            "advanced" : 80,
            "needTime" : 248116,
            "needYield" : 0,
            "saveState" : 73217,
            "restoreState" : 73217,
            "isEOF" : 1,
            "docsExamined" : 248196,
            "alreadyHasObj" : 0,
            "inputStage" : {
                "stage" : "IXSCAN",
                "nReturned" : 248196,
                "executionTimeMillisEstimate" : 707,
                "works" : 248197,
                "advanced" : 248196,
                "needTime" : 0,
                "needYield" : 0,
                "saveState" : 73217,
                "restoreState" : 73217,
                "isEOF" : 1,
                "keyPattern" : {
                    "ts_end" : 1
                },
                "indexName" : "ts_end",
                "isMultiKey" : false,
                "multiKeyPaths" : {
                    "ts_end" : []
                },
                "isUnique" : false,
                "isSparse" : false,
                "isPartial" : false,
                "indexVersion" : 2,
                "direction" : "forward",
                "indexBounds" : {
                    "ts_end" : [ 
                        "(true, new Date(1514851199000)]"
                    ]
                },
                "keysExamined" : 248196,
                "seeks" : 1,
                "dupsTested" : 0,
                "dupsDropped" : 0
            }
        }
    },
    "ts" : ISODate("2021-05-04T19:13:02.342Z"),
    "client" : "127.0.0.1",
    "allUsers" : [],
    "user" : ""
}

1 个答案:

答案 0 :(得分:0)

这是因为您试图向 self.member 发送未定义的消息,在这种情况下,您需要重新检查频道主题,因为您使用它来存储用户的 ID。

我建议使用数据库,而不是将内容存储在频道主题中。