https://github.com/ivkos/botyo-command-youtube
https://github.com/ivkos/botyo-command-youtube
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ivkos/botyo-command-youtube
- Owner: ivkos
- License: apache-2.0
- Created: 2018-03-15T14:40:57.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-07-14T07:20:23.000Z (over 7 years ago)
- Last Synced: 2025-03-21T06:34:43.801Z (10 months ago)
- Language: TypeScript
- Size: 16.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# YouTube Command for Botyo
[](https://www.npmjs.com/package/botyo-command-youtube)
[](https://www.npmjs.com/package/botyo-command-youtube)
[]()
The **YouTube Command for [Botyo](https://github.com/ivkos/botyo)** posts a YouTube video to the chat.
## Usage
`#yt `
or
`#youtube `
For example:
- `#yt Starboy`
- `#yt ozzy man cat vs mantis`
## Requirements
You need to obtain an API key to use the YouTube Data API. Please refer to the [YouTube API Reference](https://developers.google.com/youtube/v3/docs/#calling-the-api) for instructions how to do so.
## Install
**Step 1.** Install the module from npm.
`npm install --save botyo-command-youtube`
**Step 2.** Configure the API key in your configuration file `config.yaml`
```yaml
modules:
YouTubeCommand:
apiKey: YOUR_YOUTUBE_API_KEY # https://developers.google.com/youtube/v3/docs/#calling-the-api
```
**Step 3.** Register the module.
```typescript
import Botyo from "botyo";
import YouTubeCommand from "botyo-command-youtube"
Botyo.builder()
...
.registerModule(YouTubeCommand)
...
.build()
.start();
```
## Configuration
The configuration of the YouTube command modules has some sensible defaults. However, you can still override the
defaults if you need to.
```yaml
modules:
YouTubeCommand:
apiKey: YOUR_YOUTUBE_API_KEY # https://developers.google.com/youtube/v3/docs/#calling-the-api
regionCode: US # Return search results for the specified country. (ISO 3166-1 alpha-2 country code)
order: relevance # Method to use to order videos: date/rating/relevance/title/viewCount
safeSearch: moderate # Indicates whether the search results should include restricted content as well as standard content; moderate/none/strict
```
You can override all configuration properties (except `apiKey`) on a per-chat-thread basis. For example:
```yaml
modules:
YouTubeCommand:
apiKey: YOUR_YOUTUBE_API_KEY
regionCode: US
order: relevance
safeSearch: moderate
chat-threads:
SOME_CHAT_THREAD_ID:
overrides:
modules.YouTubeCommand:
regionCode: BG
order: viewCount
OTHER_CHAT_THREAD_ID:
overrides:
modules.YouTubeCommand:
enable: false # disables the command for this chat thread
```