Compare commits

..

3 Commits

Author SHA1 Message Date
Chris Plaatjes
9faaeef68f Added try catch for URL parsing 2023-02-14 14:48:47 -05:00
Chris Plaatjes
e05e4fb5e5 Updated drone yaml 2023-02-14 14:48:38 -05:00
Chris Plaatjes
a00cc167c3 Updated Dockerfile 2023-02-14 14:48:16 -05:00
3 changed files with 29 additions and 20 deletions

View File

@ -1,20 +1,26 @@
--- ---
kind: pipeline kind: pipeline
type: docker type: docker
name: build-app name: publish-bot
steps: steps:
- name: build-dotnet - name: build-dotnet
image: mcr.microsoft.com/dotnet/sdk:6.0 image: mcr.microsoft.com/dotnet/sdk:6.0
commands: 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 # Commented out until stuff actually works
#trigger: #trigger:

View File

@ -2,10 +2,6 @@ FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine3
WORKDIR /app/teletok WORKDIR /app/teletok
RUN apk update && apk add --update nodejs nodejs-npm COPY bin/Debug/net6.0/publish/* /app/teletok/
RUN npm i -g tiktok-scraper
COPY bin/Debug/net6.0/* /app/teletok/
CMD [ "TeleTok" ] CMD [ "TeleTok" ]

View File

@ -54,6 +54,8 @@ namespace TeleTok
// Passes the url along to the video downloader if it is valid AND a tiktok link // Passes the url along to the video downloader if it is valid AND a tiktok link
if (isUri) if (isUri)
{
try
{ {
if(messageText.Contains("tiktok.com")) if(messageText.Contains("tiktok.com"))
{ {
@ -66,6 +68,11 @@ namespace TeleTok
); );
} }
} }
catch
{
Console.WriteLine("Valid TikTok URI was sent, but was not a video!");
}
}
} }
Task HandlePollingErrorAsync(ITelegramBotClient botClient, Exception exception, CancellationToken cancellationToken) Task HandlePollingErrorAsync(ITelegramBotClient botClient, Exception exception, CancellationToken cancellationToken)