-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
83 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,9 @@ | ||
package InformationProcessing | ||
|
||
import ( | ||
"strings" | ||
|
||
"xyz.nyan/MediaWiki-Bot/src/Struct" | ||
"xyz.nyan/MediaWiki-Bot/src/utils" | ||
) | ||
|
||
//命令处理,判断命令是否匹配,匹配则输出命令和命令参数 | ||
func CommandExtraction(SNSName string, QQjson Struct.QQWebHook_root, text string) (bool, string, string) { | ||
if find := strings.Contains(text, ":"); find { | ||
Config := utils.ReadConfig() | ||
var ConfigWikiName string | ||
for one := range Config.Wiki.([]interface{}) { | ||
ConfigWikiName = Config.Wiki.([]interface{})[one].(map[interface{}]interface{})["WikiName"].(string) | ||
if find := strings.Contains(text, ConfigWikiName); find { | ||
countSplit := strings.SplitN(text, ":", 2) | ||
Command := countSplit[0] | ||
Text := countSplit[1] | ||
return true, Text, Command | ||
} | ||
} | ||
} else if find := strings.Contains(text, "[["); find { | ||
if find := strings.Contains(text, "]]"); find { | ||
//获取主Wiki名字 | ||
Config := utils.ReadConfig() | ||
MainWikiName := Config.Wiki.([]interface{})[0].(map[interface{}]interface{})["WikiName"].(string) | ||
|
||
trimStr := strings.Trim(text, "[") | ||
Text := strings.Trim(trimStr, "]") | ||
return true, Text, MainWikiName | ||
} | ||
} else if find := strings.Contains(text, "/"); find { | ||
switch SNSName { | ||
case "QQ": | ||
QQSettingsMessageProcessing(QQjson) | ||
} | ||
return false, "", "/" | ||
} | ||
|
||
return false, "", "" | ||
} | ||
func InformationProcessing(json Struct.WebHookJson) { | ||
QQMessageProcessing(json) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package InformationProcessing | ||
|
||
import ( | ||
"strings" | ||
|
||
"xyz.nyan/MediaWiki-Bot/src/Struct" | ||
"xyz.nyan/MediaWiki-Bot/src/utils" | ||
) | ||
|
||
//命令处理,判断命令是否匹配,匹配则输出命令和命令参数 | ||
func CommandExtraction(SNSName string, QQjson Struct.WebHookJson, text string) (bool, string, string) { | ||
if find := strings.Contains(text, ":"); find { | ||
Config := utils.ReadConfig() | ||
var ConfigWikiName string | ||
for one := range Config.Wiki.([]interface{}) { | ||
ConfigWikiName = Config.Wiki.([]interface{})[one].(map[interface{}]interface{})["WikiName"].(string) | ||
if find := strings.Contains(text, ConfigWikiName); find { | ||
countSplit := strings.SplitN(text, ":", 2) | ||
Command := countSplit[0] | ||
Text := countSplit[1] | ||
return true, Text, Command | ||
} | ||
} | ||
} else if find := strings.Contains(text, "[["); find { | ||
if find := strings.Contains(text, "]]"); find { | ||
//获取主Wiki名字 | ||
Config := utils.ReadConfig() | ||
MainWikiName := Config.Wiki.([]interface{})[0].(map[interface{}]interface{})["WikiName"].(string) | ||
|
||
trimStr := strings.Trim(text, "[") | ||
Text := strings.Trim(trimStr, "]") | ||
return true, Text, MainWikiName | ||
} | ||
} else if find := strings.Contains(text, "/"); find { | ||
switch SNSName { | ||
case "QQ": | ||
QQSettingsMessageProcessing(QQjson) | ||
} | ||
return false, "", "/" | ||
} | ||
|
||
return false, "", "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package Struct | ||
|
||
type WebHookJson struct { | ||
Type string `json:"type"` | ||
Sender Sender `json:"sender"` | ||
FromId int `json:"fromId"` | ||
Target int `json:"target"` | ||
MessageChain []interface{} `json:"messageChain"` | ||
Subject Subject `json:"subject"` | ||
} | ||
type Sender struct { | ||
Id int `json:"id"` | ||
MemberName string `json:"memberName"` | ||
SpecialTitle string `json:"specialTitle"` | ||
Permission string `json:"permission"` | ||
JoinTimestamp int `json:"joinTimestamp"` | ||
LastSpeakTimestamp int `json:"lastSpeakTimestamp"` | ||
MuteTimeRemaining int `json:"muteTimeRemaining"` | ||
Nickname string `json:"nickname"` | ||
Remark string `json:"remark"` | ||
Group Group `json:"group"` | ||
} | ||
type Group struct { | ||
Id int `json:"id"` | ||
Name string `json:"name"` | ||
} | ||
type Subject struct { | ||
Id int `json:"id"` | ||
Kind string `json:"kind"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters