This repository has been archived by the owner on Jun 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
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
14 changed files
with
167 additions
and
25 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
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package Moli | ||
|
||
import ( | ||
"OPQBot-QQGroupManager/Config" | ||
"OPQBot-QQGroupManager/GroupManager/Chat" | ||
"errors" | ||
"github.com/mcoo/requests" | ||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
var log *logrus.Entry | ||
|
||
type Core struct { | ||
replace map[string]string | ||
key string | ||
secret string | ||
} | ||
|
||
func (c *Core) GetAnswer(question string, GroupId, userId int64) string { | ||
res, err := requests.Get("http://i.itpk.cn/api.php?question=" + question + "&limit=8&api_key=" + c.key + "&api_secret=" + c.secret) | ||
if err != nil { | ||
log.Error(err) | ||
return "" | ||
} | ||
return res.Text() | ||
} | ||
|
||
func (c *Core) AddAnswer(question, answer string, GroupId, userId int64) error { | ||
return nil | ||
} | ||
|
||
func (c *Core) SetReplace(regexp string, target string) error { | ||
return nil | ||
} | ||
|
||
func (c *Core) Init(l *logrus.Entry) error { | ||
log = l | ||
Config.Lock.RLock() | ||
c.key = Config.CoreConfig.ChatKey.Moli.Key | ||
c.secret = Config.CoreConfig.ChatKey.Moli.Secret | ||
Config.Lock.RUnlock() | ||
c.replace = map[string]string{"[cqname]": "[YOU]", "[name]": "我"} | ||
if c.key == "" || c.secret == "" { | ||
return errors.New("key和密匙没有填写") | ||
} | ||
return nil | ||
} | ||
func init() { | ||
err := Chat.Register("茉莉", &Core{}) | ||
if err != nil { | ||
panic(err) | ||
} | ||
} |
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
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
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
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
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