kritzware / kritzware/twitch-bot

Middleware functionality

Open
#35 0 comments 0 reactions 0 assignees View on GitHub
discussion
Dominant language
JavaScript
Stars
159
Forks
34
PR merge metrics
No merged PRs in 30d

Description

Issue for discussion about Bot middleware functionality and ideas.

Inspired by [Express middleware functions](https://expressjs.com/en/guide/using-middleware.html).

Express implementation:
```javascript
app.use(function (req, res, next) {
console.log('Time:', Date.now())
next()
})
```

```javascript
Bot.use((chatter, send) => {
// ... some sort of operation with the chatter object, or message string

send() // Allows the message to be sent
})
```

In relation to this, the idea of custom Bot plugins would be cool e.g.
```javascript
const TwitchBotCommands = require('twitch-bot-commands')

// The custom bot module
const commands = TwitchBotCommands("!", {
"test": "command executed!",
"tweet": async chatter => {
const latestTweet = await someAsyncApiRequest(chatter.username)
return `Latest tweet: ${latestTweet}`
}
})

// Instantiate the module
Bot.module(commands)
```

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue names no repository files, tests, or entry points; start by reviewing the linked Express middleware guide and the proposed Bot.use and Bot.module examples. This is currently a discussion of possible APIs, so done would require an agreed middleware and plugin design before implementation can be scoped.

Written by the indexing model from the issue text.

Assessment

Tech stack
express, javascript
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.