From a00cc167c320a1123823944de885120a8027dd1b Mon Sep 17 00:00:00 2001 From: Chris Plaatjes Date: Tue, 14 Feb 2023 14:48:16 -0500 Subject: [PATCH 1/4] Updated Dockerfile --- Dockerfile | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9afbfcd..7fe1965 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,10 +2,6 @@ FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine3 WORKDIR /app/teletok -RUN apk update && apk add --update nodejs nodejs-npm - -RUN npm i -g tiktok-scraper - -COPY bin/Debug/net6.0/* /app/teletok/ +COPY bin/Debug/net6.0/publish/* /app/teletok/ CMD [ "TeleTok" ] \ No newline at end of file -- 2.45.2 From e05e4fb5e5d95fe75e3eb17449979f6a59315290 Mon Sep 17 00:00:00 2001 From: Chris Plaatjes Date: Tue, 14 Feb 2023 14:48:38 -0500 Subject: [PATCH 2/4] Updated drone yaml --- .drone.yml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/.drone.yml b/.drone.yml index bb8bee7..95434a5 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,20 +1,26 @@ --- kind: pipeline type: docker -name: build-app +name: publish-bot steps: - name: build-dotnet image: mcr.microsoft.com/dotnet/sdk:6.0 commands: - - dotnet build + - dotnet publish + +- name: build-image + image: plugins/docker + settings: + registry: git.kizaing.ca + username: + from_secret: DOCKER_USER + password: + from_secret: DOCKER_PASS + repo: git.kizaing.ca/kizaing/TeleTok + tags: latest + platform: linux/amd64,linux/arm64 -steps: -- name: build-docker - image: docker:dind - volumes: - - name: dockersock - path: /var/run/docker.sock # Commented out until stuff actually works #trigger: -- 2.45.2 From 9faaeef68f68dfc410d0312edf4626871b107e22 Mon Sep 17 00:00:00 2001 From: Chris Plaatjes Date: Tue, 14 Feb 2023 14:48:47 -0500 Subject: [PATCH 3/4] Added try catch for URL parsing --- TelegramListener.cs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/TelegramListener.cs b/TelegramListener.cs index 3fb63f2..1c90eed 100644 --- a/TelegramListener.cs +++ b/TelegramListener.cs @@ -55,15 +55,22 @@ namespace TeleTok // Passes the url along to the video downloader if it is valid AND a tiktok link if (isUri) { - if(messageText.Contains("tiktok.com")) + try { - proxyUrl = VidDownload.TikTokURL(messageText); + if(messageText.Contains("tiktok.com")) + { + proxyUrl = VidDownload.TikTokURL(messageText); - Message ttVideo = await botClient.SendVideoAsync( - chatId: chatId, - video: proxyUrl, - cancellationToken: cancellationToken - ); + Message ttVideo = await botClient.SendVideoAsync( + chatId: chatId, + video: proxyUrl, + cancellationToken: cancellationToken + ); + } + } + catch + { + Console.WriteLine("Valid TikTok URI was sent, but was not a video!"); } } } -- 2.45.2 From 8b42fb35b3f201265e824cea6abd023cf71a9d20 Mon Sep 17 00:00:00 2001 From: Chris Plaatjes Date: Tue, 14 Feb 2023 14:52:27 -0500 Subject: [PATCH 4/4] Added branch trigger --- .drone.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.drone.yml b/.drone.yml index 95434a5..86da13d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -23,8 +23,8 @@ steps: # Commented out until stuff actually works -#trigger: -# branch: -# - main -# event: -# - push \ No newline at end of file +trigger: + branch: + - main + event: + - push \ No newline at end of file -- 2.45.2