Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/the-software-compagny/nestjs_module_twurple
Twitch API/Chat/PubSub with Twurple NestJS module
https://github.com/the-software-compagny/nestjs_module_twurple
abstract abstraction api async chat nestjs node nodejs npm promise pubsub spaces twitch twurple
Last synced: 15 days ago
JSON representation
Twitch API/Chat/PubSub with Twurple NestJS module
- Host: GitHub
- URL: https://github.com/the-software-compagny/nestjs_module_twurple
- Owner: The-Software-Compagny
- License: bsd-3-clause
- Created: 2023-03-18T13:43:01.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-02T19:42:13.000Z (25 days ago)
- Last Synced: 2024-12-02T20:29:43.528Z (25 days ago)
- Topics: abstract, abstraction, api, async, chat, nestjs, node, nodejs, npm, promise, pubsub, spaces, twitch, twurple
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@the-software-compagny/nestjs_module_twurple
- Size: 165 KB
- Stars: 1
- Watchers: 0
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Twitch API/Chat/PubSub with Twurple NestJS module
# Twurple Module
Twurple for NestJS Framework## Install dependencies
```bash
yarn add @the-software-compagny/nestjs_module_twurple
```
## Instanciate
```ts
// 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('twurple.options'),
}),
})
```
## Usage
```ts
// 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!')
}
})
// ...
}
}
```