mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-28 08:41:29 +00:00
⚗️ add export require option
This commit is contained in:
@ -22,6 +22,8 @@ nonebot.load_builtin_plugins()
|
||||
# load local plugins
|
||||
nonebot.load_plugins("test_plugins")
|
||||
|
||||
print(nonebot.require("test_export"))
|
||||
|
||||
# modify some config / config depends on loaded configs
|
||||
config = nonebot.get_driver().config
|
||||
config.custom_config3 = config.custom_config1
|
||||
|
15
tests/test_plugins/test_export.py
Normal file
15
tests/test_plugins/test_export.py
Normal file
@ -0,0 +1,15 @@
|
||||
import nonebot
|
||||
|
||||
export = nonebot.export()
|
||||
export.foo = "bar"
|
||||
export["bar"] = "foo"
|
||||
|
||||
|
||||
@export
|
||||
def a():
|
||||
pass
|
||||
|
||||
|
||||
@export.sub
|
||||
def b():
|
||||
pass
|
Reference in New Issue
Block a user