File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change 11let modules = {
2- "WebSocket" : "ws"
2+ "WebSocket" : "ws" ,
3+ "https" : "https"
34}
5+
46for ( let module in modules ) {
57 let module_name = module ;
68 let module_path = modules [ module_name ] ;
79 try {
8- require ( module_path ) ;
10+ global [ module_name ] = require ( module_path ) ;
911 } catch ( e ) {
1012 throw new Error ( `导入${ module_name } 失败(位于${ module_path } )` )
1113 }
12- global [ module_name ] = require ( module_path ) ;
1314}
1415
1516class Client {
1617 constructor ( server_ip ) {
17- this . _ws = new WebSocket ( server_ip ) ;
18+ this . _ws = server_ip == "wss://hack.chat/chat-ws" ?
19+ new WebSocket ( 'wss://104.131.138.176/chat-ws' , {
20+ headers : {
21+ host : 'hack.chat' // 反DNS污染
22+ } ,
23+ rejectUnauthorized : false
24+ } ) :
25+ new WebSocket ( server_ip )
1826 this . _ws . onopen = ( ) => {
1927 this . onjoin ( ) ;
2028 }
Original file line number Diff line number Diff line change 33这是一个一个用于使用Nodejs在 hack.chat 开发简单机器人的轻量框架
44你可以查看[ Wiki] ( https://github.com/cmd1152/hackchat-botlib/wiki ) 来了解用法
55
6+ ** 本框架通过伪造 SNI 请求头实现防 DNS 污染**
7+
68使用这个框架,您就不必处理
9+
10+ - ** DNS污染怎么办**
711- 在线列表
812- 机器人在用户手动改名(比如直接执行代码发送changeNick)后怎么知道新名称
913- whisper和emote怎么提取用户原始内容
You can’t perform that action at this time.
0 commit comments