Skip to content

Commit ebec383

Browse files
committed
fix: fix incorrect decorator usage on generic class
1 parent b215b2f commit ebec383

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

src/services/twitch.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
isStreamOnline, stats, streamStatusChangeSince,
2828
} from '~/helpers/api';
2929
import { prepare } from '~/helpers/commons/prepare';
30+
import { start } from '~/helpers/core/stream';
3031
import defaultPermissions from '~/helpers/permissions/defaultPermissions';
3132
import { adminEndpoint } from '~/helpers/socket';
3233
import {
@@ -38,6 +39,7 @@ import { isIgnored } from '~/helpers/user/isIgnored';
3839
import { sendGameFromTwitch } from '~/services/twitch/calls/sendGameFromTwitch';
3940
import { updateChannelInfo } from '~/services/twitch/calls/updateChannelInfo';
4041
import { translate } from '~/translate';
42+
import { variables } from '~/watchers';
4143

4244
const urls = {
4345
'SogeBot Token Generator': 'https://twitch-token-generator.soge.workers.dev/refresh/',
@@ -260,8 +262,14 @@ class Twitch extends Service {
260262
}
261263

262264
@onStreamStart()
263-
reconnectOnStreamStart() {
265+
async reconnectOnStreamStart() {
266+
const broadcasterUsername = variables.get('services.twitch.broadcasterUsername') as string;
267+
264268
this.uptime = 0;
269+
await this.tmi?.part('bot');
270+
await this.tmi?.join('bot', broadcasterUsername);
271+
await this.tmi?.part('broadcaster');
272+
await this.tmi?.join('broadcaster', broadcasterUsername);
265273
}
266274

267275
@onChange('showWithAt')

src/services/twitch/chat.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { parserReply } from '~/commons';
2222
import { AppDataSource } from '~/database';
2323
import { timer } from '~/decorators';
2424
import {
25-
getFunctionList, onStreamStart,
25+
getFunctionList,
2626
} from '~/decorators/on';
2727
import { isStreamOnline, stats } from '~/helpers/api';
2828
import * as hypeTrain from '~/helpers/api/hypeTrain';
@@ -85,13 +85,6 @@ class Chat {
8585
this.initClient('broadcaster');
8686
}
8787

88-
@onStreamStart()
89-
reconnectOnStreamStart() {
90-
const broadcasterUsername = variables.get('services.twitch.broadcasterUsername') as string;
91-
this.part('bot').then(() => this.join('bot', broadcasterUsername));
92-
this.part('broadcaster').then(() => this.join('broadcaster', broadcasterUsername));
93-
}
94-
9588
emitter() {
9689
if (!tmiEmitter) {
9790
setTimeout(() => this.emitter(), 10);

0 commit comments

Comments
 (0)