Commit 8b411397 authored by nanahira's avatar nanahira

add constructor in config schema

parent 114a2e41
...@@ -2,113 +2,17 @@ import dgram from 'dgram'; ...@@ -2,113 +2,17 @@ import dgram from 'dgram';
import _ from 'lodash'; import _ from 'lodash';
const messageStage1 = [ const messageStage1 = [
1, 1, 2, 0, 42, 49, 127, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 42, 49, 127, 0,
2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 109, 44, 0, 0,
0,
42,
49,
127,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
2,
0,
42,
49,
127,
0,
0,
1,
0,
0,
0,
0,
0,
0,
0,
0,
109,
44,
0,
0,
]; ];
const smallMessage = [3]; const smallMessage = [3];
const messageStage2 = [ const messageStage2 = [
5, 5, 110, 115, 101, 217, 255, 196, 110, 72, 141, 124, 161, 146, 49, 52, 114,
110, 149, 16, 0, 1, 0, 40, 0, 0, 0, 1, 9, 112, 114, 111, 102, 105, 108, 101, 49,
115, 112, 0, 0, 0, 0, 0, 81, 57, 68, 0, 74, 2, 65, 8, 0, 0, 0, 0, 0, 0, 0, 0, 51,
101, 1, 0, 0, 18, 0, 0, 0,
217,
255,
196,
110,
72,
141,
124,
161,
146,
49,
52,
114,
149,
16,
0,
1,
0,
40,
0,
0,
0,
1,
9,
112,
114,
111,
102,
105,
108,
101,
49,
112,
0,
0,
0,
0,
0,
81,
57,
68,
0,
74,
2,
65,
8,
0,
0,
0,
0,
0,
0,
0,
0,
51,
1,
0,
0,
18,
0,
0,
0,
]; ];
enum AttackType { enum AttackType {
...@@ -251,7 +155,7 @@ export class Attacker { ...@@ -251,7 +155,7 @@ export class Attacker {
this.socket.on('error', (err) => { this.socket.on('error', (err) => {
this.error = err; this.error = err;
}); });
for (let step of AttackRoutine) { for (const step of AttackRoutine) {
if (this.error) { if (this.error) {
return `Error: ${this.error.toString()}`; return `Error: ${this.error.toString()}`;
} }
......
...@@ -7,6 +7,7 @@ import path from 'path'; ...@@ -7,6 +7,7 @@ import path from 'path';
@RegisterSchema() @RegisterSchema()
export class HisoutensokuJammerPluginConfig { export class HisoutensokuJammerPluginConfig {
constructor(config: Partial<HisoutensokuJammerPluginConfig>) {}
@DefineSchema({ description: '干扰时间', default: 10000 }) @DefineSchema({ description: '干扰时间', default: 10000 })
attackTimeout: number; attackTimeout: number;
...@@ -65,4 +66,5 @@ export class HisoutensokuJammerPluginConfig { ...@@ -65,4 +66,5 @@ export class HisoutensokuJammerPluginConfig {
} }
} }
export type HisoutensokuJammerPluginConfigLike = Partial<HisoutensokuJammerPluginConfig>; export type HisoutensokuJammerPluginConfigLike =
Partial<HisoutensokuJammerPluginConfig>;
...@@ -30,8 +30,10 @@ declare module 'koishi' { ...@@ -30,8 +30,10 @@ declare module 'koishi' {
} }
} }
const matcherGlobal = /([1-2]? *\d? *\d *)(([^\d][1-2]?\d{1,2}){3}).+?([1-6] *\d *\d *\d *\d)/g; const matcherGlobal =
const matcherSingle = /([1-2]? *\d? *\d *)(([^\d][1-2]?\d{1,2}){3}).+?([1-6] *\d *\d *\d *\d)/; /([1-2]? *\d? *\d *)(([^\d][1-2]?\d{1,2}){3}).+?([1-6] *\d *\d *\d *\d)/g;
const matcherSingle =
/([1-2]? *\d? *\d *)(([^\d][1-2]?\d{1,2}){3}).+?([1-6] *\d *\d *\d *\d)/;
const PROTOCOL_BASE64 = 'base64://'; const PROTOCOL_BASE64 = 'base64://';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment