This repository was archived by the owner on May 14, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Server Usage
runoneall edited this page Feb 4, 2025
·
12 revisions
简体中文 | English
Language translations may not be 100% accurate
Language translations may not be 100% accurate
from RyhBotPythonSDK import Server@Server.Message.Normal
def NormalHandle(data):
# Your Logic codes@Server.Message.Command
def CommandHandle(data):
# Your Logic codes@Server.Message.BotFollowed
def BotFollowedHandle(data):
# Your Logic codes@Server.Message.BotUnFollowed
def BotUnFollowedHandle(data):
# Your Logic codes@Server.Message.BotSettings
def BotSettingsHandle(data):
# Your Logic codes@Server.Message.GroupJoin
def GroupJoinHandle(data):
# Your Logic codes@Server.Message.GroupLeave
def GroupLeaveHandle(data):
# Your Logic codes@Server.Message.ButtonClick
def ButtonClickHandle(data):
# Your Logic codes@Server.Message.AllType
def AllTypeHandle(data):
# Your Logic codesdef precall(data: dict):
# Your Logic codes
return data
Server.PreCall = precallRun some scripts when a request comes in, such as modifying sender
The precall function accepts a parameter representing the complete request body from the Yunhu server, but only the event field will be passed to the Server.Message decorator function
In addition to modifying the request body, this function can also terminate the response early, using the return keyword to return a string starting with !SERVER: with a response code, such as !SERVER:400 to return a 400 Bad Request error.
# Your Logic codes
Server.Start(
host = "Host"
port = Port # Int
debug = (True / False) # Whether to enable debug mode
)Developer: Runoneall
Translator: Spectrollay
This document is written by English and 简体中文.
English
本文档由English和简体中文编写。
简体中文