trashbin-scheduler-bot-tg 1.1.13 → 1.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -0
- package/db/2026-11.json +27 -0
- package/package.json +1 -1
- package/trashbin-day-handler.js +16 -0
package/README.md
CHANGED
|
@@ -127,6 +127,38 @@ Each file in `db/` is a JSON array of daily entries:
|
|
|
127
127
|
| `NO SERVICE` | ⛔️ |
|
|
128
128
|
| `UNKNOWN` | ❓ |
|
|
129
129
|
|
|
130
|
+
## Release and deployment rules
|
|
131
|
+
|
|
132
|
+
### Cut a new version
|
|
133
|
+
|
|
134
|
+
Use the repository release workflow to produce a tagged release:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# 1. Update the month schedule or any user-facing code changes
|
|
138
|
+
# 2. Bump the package version (patch/minor/major depending on the scope)
|
|
139
|
+
npm version patch
|
|
140
|
+
|
|
141
|
+
# 3. Confirm the bundled release artifact still builds
|
|
142
|
+
npm run build
|
|
143
|
+
|
|
144
|
+
# 4. Commit the release changes
|
|
145
|
+
git add package.json package-lock.json db/*.json
|
|
146
|
+
git commit -m "Release vX.Y.Z"
|
|
147
|
+
|
|
148
|
+
# 5. Create an annotated tag and push it to GitHub
|
|
149
|
+
git tag -a vX.Y.Z -m "Release vX.Y.Z"
|
|
150
|
+
git push origin main --tags
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
The workflow in [.github/workflows/release.yml](.github/workflows/release.yml) is triggered by tags matching `v*` and will:
|
|
154
|
+
|
|
155
|
+
1. build the single-file bundle,
|
|
156
|
+
2. attach it to a GitHub Release,
|
|
157
|
+
3. publish to npm, and
|
|
158
|
+
4. publish a scoped package to GitHub Packages.
|
|
159
|
+
|
|
160
|
+
If you are only changing schedule data, a patch release is normally enough. If the bot behavior or config format changes, choose `minor` or `major` according to semantic versioning.
|
|
161
|
+
|
|
130
162
|
## Running with PM2
|
|
131
163
|
|
|
132
164
|
```bash
|
package/db/2026-11.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[
|
|
2
|
+
{ "date": "2026-11-02", "type": "ORGANICO" },
|
|
3
|
+
{ "date": "2026-11-03", "type": "PLASTICA E METALLI" },
|
|
4
|
+
{ "date": "2026-11-04", "type": "ORGANICO" },
|
|
5
|
+
{ "date": "2026-11-05", "type": "SECCO RESIDUO" },
|
|
6
|
+
{ "date": "2026-11-06", "type": "CARTA E CARTONE" },
|
|
7
|
+
{ "date": "2026-11-07", "type": "ORGANICO" },
|
|
8
|
+
{ "date": "2026-11-09", "type": "ORGANICO" },
|
|
9
|
+
{ "date": "2026-11-10", "type": "PLASTICA E METALLI" },
|
|
10
|
+
{ "date": "2026-11-11", "type": "ORGANICO" },
|
|
11
|
+
{ "date": "2026-11-12", "type": "VETRO" },
|
|
12
|
+
{ "date": "2026-11-13", "type": "CARTA E CARTONE" },
|
|
13
|
+
{ "date": "2026-11-14", "type": "ORGANICO" },
|
|
14
|
+
{ "date": "2026-11-16", "type": "ORGANICO" },
|
|
15
|
+
{ "date": "2026-11-17", "type": "PLASTICA E METALLI" },
|
|
16
|
+
{ "date": "2026-11-18", "type": "ORGANICO" },
|
|
17
|
+
{ "date": "2026-11-19", "type": "SECCO RESIDUO" },
|
|
18
|
+
{ "date": "2026-11-20", "type": "CARTA E CARTONE" },
|
|
19
|
+
{ "date": "2026-11-21", "type": "ORGANICO" },
|
|
20
|
+
{ "date": "2026-11-23", "type": "ORGANICO" },
|
|
21
|
+
{ "date": "2026-11-24", "type": "PLASTICA E METALLI" },
|
|
22
|
+
{ "date": "2026-11-25", "type": "ORGANICO" },
|
|
23
|
+
{ "date": "2026-11-26", "type": "VETRO" },
|
|
24
|
+
{ "date": "2026-11-27", "type": "CARTA E CARTONE" },
|
|
25
|
+
{ "date": "2026-11-28", "type": "ORGANICO" },
|
|
26
|
+
{ "date": "2026-11-30", "type": "ORGANICO" }
|
|
27
|
+
]
|
package/package.json
CHANGED
package/trashbin-day-handler.js
CHANGED
|
@@ -70,6 +70,20 @@ bot.onText(/\/subscribers/, async (msg) => {
|
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
|
|
73
|
+
// Command for users to subscribe themselves to daily notices.
|
|
74
|
+
bot.onText(/\/subscribe/, (msg) => {
|
|
75
|
+
const chatId = msg.chat && msg.chat.id;
|
|
76
|
+
if (!chatId) return;
|
|
77
|
+
try {
|
|
78
|
+
const wasSubscribed = getSubscribers(__dirname).includes(String(chatId));
|
|
79
|
+
subscribeChat(String(chatId), __dirname);
|
|
80
|
+
bot.sendMessage(chatId, wasSubscribed ? 'You are already subscribed to daily updates.' : 'You are subscribed to daily updates.');
|
|
81
|
+
} catch (e) {
|
|
82
|
+
console.error('Failed to subscribe:', e.message);
|
|
83
|
+
bot.sendMessage(chatId, 'Unable to subscribe right now.');
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
73
87
|
// Command for users to unsubscribe themselves TODO: is not working yet.
|
|
74
88
|
bot.onText(/\/unsubscribe/, (msg) => {
|
|
75
89
|
const chatId = msg.chat && msg.chat.id;
|
|
@@ -151,6 +165,7 @@ bot.onText(/\/(help|start)/, (msg) => {
|
|
|
151
165
|
const outMsg = [
|
|
152
166
|
'🤖 Trashbin Scheduler Bot — available commands:',
|
|
153
167
|
'',
|
|
168
|
+
'/subscribe — receive daily updates',
|
|
154
169
|
'/info — today\'s collection + what to put out tonight',
|
|
155
170
|
'/week — schedule for the next 7 days',
|
|
156
171
|
'/month — full calendar for the current month',
|
|
@@ -252,6 +267,7 @@ const sendStartupNotification = () => {
|
|
|
252
267
|
|
|
253
268
|
// register the command list so it shows in Telegram's UI menu
|
|
254
269
|
bot.setMyCommands([
|
|
270
|
+
{ command: 'subscribe', description: 'Receive daily updates' },
|
|
255
271
|
{ command: 'info', description: "Today's collection + what to put out tonight" },
|
|
256
272
|
{ command: 'week', description: 'Schedule for the next 7 days' },
|
|
257
273
|
{ command: 'month', description: 'Full calendar for the current month' },
|