public class BotManagerImpl extends Object implements BotManager
BotManager
的基础实现类,使用Map储存数据。Constructor and Description |
---|
BotManagerImpl(PathAssembler pathAssembler,
VerifyFunction verifyFunction) |
Modifier and Type | Method and Description |
---|---|
BotInfo[] |
bots()
获取全部的bots信息
|
BotInfo |
defaultBot()
大多数情况下,可能不一定必须指定一个bot,则此方法规定获取一个默认的bot
|
BotInfo |
getBot(String botCode)
通过bot的code获取一个Bot的信息
|
PathAssembler |
getPathAssembler()
获取路径拼接函数
|
VerifyFunction |
getVerifyFunction()
获取注册用的验证函数
|
BotInfo |
logOutBot(String code)
注销掉一个bot,将其从bot列表中移除。
|
void |
refreshBot(String code)
刷新一个Bot的账号信息
|
BotInfo |
registerBot(BotInfo info)
注册一个botInfo。在实现的时候需要注意线程安全问题,概率较小,但是不是没有可能
|
void |
setDefaultBot(String botCode)
设置默认bot的账号信息
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
refreshBot, registerBot, registerBot, registerBot, registerBot
public BotManagerImpl(PathAssembler pathAssembler, VerifyFunction verifyFunction)
public BotInfo defaultBot()
defaultBot
in interface BotManager
public void setDefaultBot(String botCode)
setDefaultBot
in interface BotManager
botCode
- 默认bot的账号信息public BotInfo getBot(String botCode)
getBot
in interface BotManager
botCode
- 账号public BotInfo[] bots()
bots
in interface BotManager
public BotInfo registerBot(BotInfo info)
registerBot
in interface BotManager
info
- bot信息,作为key的code信息将会从其中获取。info中path必须存在。
会对账号进行一次验证,如果通过则会添加。public BotInfo logOutBot(String code)
logOutBot
in interface BotManager
code
- 要注销掉的bot账号public void refreshBot(String code)
refreshBot
in interface BotManager
code
- 要刷新的bot账号的信息public VerifyFunction getVerifyFunction()
getVerifyFunction
in interface BotManager
public PathAssembler getPathAssembler()
getPathAssembler
in interface BotManager
Copyright © 2020. All rights reserved.