-
Notifications
You must be signed in to change notification settings - Fork 1
Plugin Usage
runoneall edited this page Dec 11, 2024
·
14 revisions
简体中文 | English
Language translations may not be 100% accurate
Language translations may not be 100% accurate
from RyhBotPythonSDK.Plugin import Plugin
This manager is a python file. Run python3 plugin-tool.py
with python to get usage instructions.
python3 plugin-tool.py install <url>
-
<url>
: Resource address, a compressed package ending in .zip format
python3 plugin-tool.py loadfile <file path>
-
<file path>
: File address. When you cannot download the plug-in through the Internet, use this command to install it from a local file. It is a compressed package ending in .zip format.
python3 plugin-tool.py info <plugin name>
-
<plugin name>
: Plugin name, use this command to get detailed information about a plugin
python3 plugin-tool.py list
List all installed plugins
python3 plugin-tool.py remove <plugin name>
-
<plugin name>
: Plugin name, use this command to remove a plugin
A built-in plugin. Provides Html message support for RyhBotPythonSDK
HtmlPlugin = Plugin.Html
HtmlPlugin.SendHtml.Token="Your message token can be found in the Yunhu backend"
HtmlPlugin.SendHtml.Send(
recvId = "Target ID",
recvType = "Target Type",
html = 'HTML text'
)
A built-in plugin. Easier and more intuitive use of Sqlite database
SqlitePlugin = Plugin.Sqlite
database, cursor = SqlitePlugin.db.connect('Path to your sqlite file')
SqlitePlugin.Execute.database = database
SqlitePlugin.Execute.create_table(
cursor,
table_info = {
'name': 'Table Name',
'item': [
{'id': 'INTEGER PRIMARY KEY AUTOINCREMENT'}, # Key
{'text': 'TEXT'}, # Item
... # Items
]
}
)
SqlitePlugin.Execute.insert(
cursor,
insert_info = {
'name': 'Table Name',
'item': [
{'text': '"aaa"'}, # Item
... # Items
]
}
)
SqlitePlugin.Execute.drop_table(
cursor,
table_name = 'Table Name'
)
result = SqlitePlugin.Execute.run_command(
cursor,
"Sql Command"
)
print(result)
SqlitePlugin.Execute.delete(
cursor,
table_name = 'Table Name',
condition = 'id=1' # Filter conditions, optional
)
SqlitePlugin.Execute.update(
cursor,
update_info = {
'name': 'Table Name',
'item': [
{'text': '"update test"'}, # Item
... # Items
]
},
condition = 'id=1' # Filter conditions, optional
)
result = SqlitePlugin.Execute.select(
cursor,
table_name = 'Table Name',
condition = 'id=1' # Filter conditions, optional
)
print(result)
SqlitePlugin.db.disconnect(cursor, database)
A built-in plugin. Easier and more intuitive use of MySql database
MysqlPlugin = Plugin.MySql
database, cursor = MysqlPlugin.db.connect(
host="Mysql Host Address",
port=Mysql Port,
user="Mysql User Name",
password="Mysql Password",
database="Target Database Name"
)
MysqlPlugin.Execute.database = database
MysqlPlugin.Execute.create_table(
cursor,
table_info = {
'name': 'Table Name',
'item': [
{'id': 'INT PRIMARY KEY AUTO_INCREMENT'}, # Key
{'text': 'TEXT'}, # Item
... # Items
]
}
)
MysqlPlugin.Execute.insert(
cursor,
insert_info = {
'name': 'Table Name',
'item': [
{'text': "'aaa'"}, # Item
... # Items
]
}
)
MysqlPlugin.Execute.drop_table(
cursor,
table_name = 'Table Name'
)
result = MysqlPlugin.Execute.run_command(
cursor,
"Sql Command"
)
print(result)
MysqlPlugin.Execute.delete(
cursor,
table_name = 'Table Name',
condition = 'id=1' # Filter conditions, optional
)
MysqlPlugin.Execute.update(
cursor,
update_info = {
'name': 'Table Name',
'item': [
{'text': "'bbb'"}, # Item
... # Items
]
},
condition = 'id=1' # Filter conditions, optional
)
result = MysqlPlugin.Execute.select(
cursor,
table_name = 'Table Name',
condition = 'id=1' # Filter conditions, optional
)
print(result)
MysqlPlugin.db.disconnect(database, cursor)
Developer: Runoneall
Translator: Spectrollay
This document is written by English and 简体中文.
English
本文档由English和简体中文编写。
简体中文