forked from YunYouJun/mirai-ts
-
Notifications
You must be signed in to change notification settings - Fork 0
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
34 changed files
with
1,379 additions
and
1,364 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
import fs from "fs"; | ||
import path from "path"; | ||
import { Mirai } from "mirai-ts"; | ||
import type { MiraiApiHttpSetting } from "mirai-ts"; | ||
import yaml from "js-yaml"; | ||
import fs from 'fs' | ||
import path from 'path' | ||
import { Mirai } from 'mirai-ts' | ||
import type { MiraiApiHttpSetting } from 'mirai-ts' | ||
import yaml from 'js-yaml' | ||
|
||
const qq = 712727946; | ||
const qq = 712727946 | ||
// setting 可直接读取 setting.yml 或参考 `src/types/setting.ts` | ||
const setting = yaml.load( | ||
fs.readFileSync( | ||
path.resolve( | ||
__dirname, | ||
"../mcl/config/net.mamoe.mirai-api-http/setting.yml" | ||
'../mcl/config/net.mamoe.mirai-api-http/setting.yml', | ||
), | ||
"utf8" | ||
) | ||
) as MiraiApiHttpSetting; | ||
'utf8', | ||
), | ||
) as MiraiApiHttpSetting | ||
|
||
const mirai = new Mirai(setting); | ||
const mirai = new Mirai(setting) | ||
|
||
async function app() { | ||
await mirai.link(qq); | ||
mirai.on("message", (msg) => { | ||
await mirai.link(qq) | ||
mirai.on('message', (msg) => { | ||
// eslint-disable-next-line no-console | ||
console.log(msg); | ||
console.log(msg) | ||
// 复读 | ||
msg.reply(msg.messageChain); | ||
}); | ||
mirai.listen(); | ||
msg.reply(msg.messageChain) | ||
}) | ||
mirai.listen() | ||
} | ||
|
||
app(); | ||
app() |
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 |
---|---|---|
@@ -1,26 +1,26 @@ | ||
import type { MiraiApiHttpSetting, MiraiOptions } from "."; | ||
import type { MiraiApiHttpSetting, MiraiOptions } from '.' | ||
|
||
export const defaultMahSetting: MiraiApiHttpSetting = { | ||
adapters: ["http", "ws"], | ||
adapters: ['http', 'ws'], | ||
enableVerify: true, | ||
verifyKey: "el-psy-congroo", | ||
verifyKey: 'el-psy-congroo', | ||
debug: true, | ||
singleMode: false, | ||
cacheSize: 4096, | ||
adapterSettings: { | ||
http: { | ||
host: "localhost", | ||
host: 'localhost', | ||
port: 4859, | ||
}, | ||
ws: { | ||
host: "localhost", | ||
host: 'localhost', | ||
port: 4859, | ||
}, | ||
}, | ||
}; | ||
} | ||
|
||
export const defaultMiraiOptions: MiraiOptions = { | ||
ws: { | ||
heartbeatInterval: 60000, | ||
}, | ||
}; | ||
} |
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
Oops, something went wrong.