@the-software-compagny/nestjs_module_twurple
v1.0.0
Published
Twitch API/Chat/PubSub with Twurple NestJS module
Downloads
1
Readme
Twurple Module
Twurple for NestJS Framework
Install dependencies
yarn add @the-software-compagny/nestjs_module_twurple
Instanciate
// app.module.ts
import { TwurpleModule, TwurpleOptions } from '@the-software-compagny/nestjs_module_twurple'
TwurpleModule.forRootAsync({
imports: [ConfigModule],
inject: [ConfigService],
useFactory: async (config: ConfigService) => ({
config: config.get<TwurpleOptions>('twurple.options'),
}),
})
Usage
// twitch.service.ts
import { FactorydriveService } from '@the-software-compagny/nestjs_module_factorydrive'
@Injectable()
export class FileStorageService {
public constructor(
@InjectTwurpleApi() private readonly twurpleApi: ApiClient,
@InjectTwurpleChat() private readonly twurpleChat: ChatClient,
@InjectTwurplePubsub() private readonly twurplePubSub: PubSubClient,
) {
// ...
this.twurpleChat.onMessage(async (channel, user, message) => {
if (message === '!ping') {
this.twurpleChat.say(channel, 'Pong!')
}
})
// ...
}
}