Skip to content

Commit

Permalink
支持自定义运行端口
Browse files Browse the repository at this point in the history
  • Loading branch information
NekoRabi committed Sep 7, 2023
1 parent ef9316f commit 64721e8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 3 additions & 1 deletion config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ adapter: # Mirai-Api-Http
port: 17280
verify_key: NekoRabi

runport: 17580 # 机器人开在那个端口上,不能和上面一样

botconfig:
botname: "" # 机器人名字
qq: 123456 # 机器人QQ
Expand Down Expand Up @@ -68,4 +70,4 @@ settings: # 功能开关
norepeat: false # 全局自动回复
help: true # 是否显示帮助
# saveflashimg: false # 保存闪照
general_help: true # 自动生成帮助图片
general_help: false # 自动生成帮助图片
2 changes: 1 addition & 1 deletion core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def create_init_config():
welcomeinfo=["欢迎%ps%加入%gn%"], alarmclockgroup=[0],
trash_folders=['./images/MajSoulInfo', './images/PetPet', './images/Remake',
'./images/ImgGenerator'],
silencegroup=[0], disnudgegroup=[0], commandpre="",
silencegroup=[0], disnudgegroup=[0], commandpre="", runport=17580,
master=0, loglevel="INFO", replyimgpath='fox', botconfig=dict(qq=123456, botname=""),
nudgeconfig=dict(disnudgegroup=[0], sendnudgechance=0.3, supernudgequantity=10,
supersendnudgechance=0.2),
Expand Down
7 changes: 3 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
if __name__ == '__main__':

config = load_config()
if config.get('setting',{}).get('general_help',True):
if config.get('setting', {}).get('general_help', True):
create_helpimg()
settings = config['settings']
botname = config['botconfig']['botname']
Expand All @@ -38,7 +38,7 @@ def add_event_log(event: MessageEvent):
if type(item) != Source:
msgchain.append(item)
_info = {'groupid': event.group.id, 'groupname': event.group.name, 'membername': event.sender.member_name,
'message': msgchain}
'message': msgchain}
root_logger.info(_info)
elif isinstance(event, FriendMessage):
msgchain = []
Expand All @@ -59,8 +59,7 @@ def add_event_log(event: MessageEvent):
# except Exception as _e:
# print(f'闪照保存发生错误: {_e}')


scheduler.add_job(cmdbuffer.clearcache, 'cron', hour='0')
scheduler.add_job(cleaner.do_clean, 'cron', hour='0')

bot.run(port=17580)
bot.run(port=config.get("runport", 17580))

0 comments on commit 64721e8

Please sign in to comment.