Spaces:
Running
Running
Fixed message called other module's function, it return module is not defined
Browse files- discord_bot.py +1 -0
discord_bot.py
CHANGED
@@ -306,6 +306,7 @@ async def on_message(message):
|
|
306 |
# 如果规则指定了函数,则调用对应的函数
|
307 |
if "function" in rule:
|
308 |
function_name = rule["function"]
|
|
|
309 |
result = eval(f"await {function_name}()")
|
310 |
await message.channel.send(result)
|
311 |
# 否则发送预定义的响应消息
|
|
|
306 |
# 如果规则指定了函数,则调用对应的函数
|
307 |
if "function" in rule:
|
308 |
function_name = rule["function"]
|
309 |
+
load_module_by_function_name(function_name)
|
310 |
result = eval(f"await {function_name}()")
|
311 |
await message.channel.send(result)
|
312 |
# 否则发送预定义的响应消息
|