Skip to content

Commit bb3730c

Browse files
authored
Merge pull request #33 from derogab/dev
v1.6.1
2 parents f53e919 + 6902337 commit bb3730c

File tree

4 files changed

+80
-19
lines changed

4 files changed

+80
-19
lines changed

.github/workflows/docker-publish.yml

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ on:
2121

2222
env:
2323
# Use docker.io for Docker Hub if empty
24-
REGISTRY: ghcr.io
24+
GITHUB_REGISTRY: ghcr.io
25+
DOCKER_REGISTRY: docker.io
2526
# github.repository as <account>/<repo>
2627
IMAGE_NAME: ${{ github.repository }}
2728

@@ -45,7 +46,7 @@ jobs:
4546
fi
4647
4748
# Push image to GitHub Packages.
48-
push:
49+
push-to-github-packages:
4950

5051
# Ensure test job passes before pushing image.
5152
needs: test
@@ -67,11 +68,11 @@ jobs:
6768

6869
# Login against a Docker registry except on PR
6970
# https://github.com/docker/login-action
70-
- name: Log into registry ${{ env.REGISTRY }}
71+
- name: Log into registry ${{ env.GITHUB_REGISTRY }}
7172
if: github.event_name != 'pull_request'
7273
uses: docker/login-action@v1
7374
with:
74-
registry: ${{ env.REGISTRY }}
75+
registry: ${{ env.GITHUB_REGISTRY }}
7576
username: ${{ github.actor }}
7677
password: ${{ secrets.GITHUB_TOKEN }}
7778

@@ -81,7 +82,57 @@ jobs:
8182
id: meta
8283
uses: docker/metadata-action@v3
8384
with:
84-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
85+
images: ${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}
86+
87+
# Build and push Docker image with Buildx (don't push on PR)
88+
# https://github.com/docker/build-push-action
89+
- name: Build and push Docker image
90+
uses: docker/build-push-action@v2
91+
with:
92+
context: .
93+
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
94+
push: ${{ github.event_name != 'pull_request' }}
95+
tags: ${{ steps.meta.outputs.tags }}
96+
labels: ${{ steps.meta.outputs.labels }}
97+
98+
# Push image to Docker Hub.
99+
push-to-docker-hub:
100+
101+
# Ensure test job passes before pushing image.
102+
needs: test
103+
104+
runs-on: ubuntu-latest
105+
permissions:
106+
contents: read
107+
packages: write
108+
109+
steps:
110+
- name: Checkout
111+
uses: actions/checkout@v2
112+
113+
- name: Set up QEMU
114+
uses: docker/setup-qemu-action@v1
115+
116+
- name: Set up Docker Buildx
117+
uses: docker/setup-buildx-action@v1
118+
119+
# Login against a Docker registry except on PR
120+
# https://github.com/docker/login-action
121+
- name: Log into registry ${{ env.DOCKER_REGISTRY }}
122+
if: github.event_name != 'pull_request'
123+
uses: docker/login-action@v1
124+
with:
125+
registry: ${{ env.DOCKER_REGISTRY }}
126+
username: ${{ secrets.DOCKERHUB_USERNAME }}
127+
password: ${{ secrets.DOCKERHUB_TOKEN }}
128+
129+
# Extract metadata (tags, labels) for Docker
130+
# https://github.com/docker/metadata-action
131+
- name: Extract Docker metadata
132+
id: meta
133+
uses: docker/metadata-action@v3
134+
with:
135+
images: ${{ env.IMAGE_NAME }}
85136

86137
# Build and push Docker image with Buildx (don't push on PR)
87138
# https://github.com/docker/build-push-action
@@ -92,4 +143,4 @@ jobs:
92143
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
93144
push: ${{ github.event_name != 'pull_request' }}
94145
tags: ${{ steps.meta.outputs.tags }}
95-
labels: ${{ steps.meta.outputs.labels }}
146+
labels: ${{ steps.meta.outputs.labels }}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "clownbot",
3-
"version": "1.6.0",
3+
"version": "1.6.1",
44
"description": "A telegram bot to cheer up conversations in own chat groups",
55
"main": "bot.js",
66
"scripts": {

routes/hears.js

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
* =====================
44
* If i write "hi" bot response "hello"
55
*/
6-
const { Markup } = require('telegraf');
7-
86
module.exports = function (bot, info, config, auth) {
97

108
bot.hears(/\bping\b/i, (ctx) => {
@@ -63,22 +61,34 @@ module.exports = function (bot, info, config, auth) {
6361

6462
bot.hears(/(spara|kill|shoot)/i, (ctx) => {
6563
if(auth(ctx)) {
64+
65+
// Set keyboard for telegram message
66+
const inlineMessageKeyboard = [[
67+
{ text: 'Shoot!', callback_data: 'shoot' }
68+
]];
69+
70+
// Send message with keyboard
6671
ctx.replyWithAnimation(
67-
'https://media.giphy.com/media/26xopsR7cWySdKNgY/giphy.gif',
68-
Markup.inlineKeyboard([
69-
Markup.callbackButton('Shoot!', 'shoot')
70-
]).extra()
72+
'https://media.giphy.com/media/26xopsR7cWySdKNgY/giphy.gif', {
73+
reply_markup: JSON.stringify({ inline_keyboard: inlineMessageKeyboard })
74+
}
7175
);
7276
}
7377
});
7478

7579
bot.hears(/(boo*om|bomba|bomb|explosion|esplosione)/i, (ctx) => {
7680
if(auth(ctx)) {
81+
82+
// Set keyboard for telegram message
83+
const inlineMessageKeyboard = [[
84+
{ text: 'Boom!', callback_data: 'boom' }
85+
]];
86+
87+
// Send message with keyboard
7788
ctx.replyWithAnimation(
78-
'https://media.giphy.com/media/3o7qEcqN5PjN90jNC0/source.gif',
79-
Markup.inlineKeyboard([
80-
Markup.callbackButton('Boom!', 'boom')
81-
]).extra()
89+
'https://media.giphy.com/media/3o7qEcqN5PjN90jNC0/source.gif', {
90+
reply_markup: JSON.stringify({ inline_keyboard: inlineMessageKeyboard })
91+
}
8292
);
8393
}
8494
});

0 commit comments

Comments
 (0)