4 Commits

Author SHA1 Message Date
8461afd08f Fixed runner repo links
Some checks failed
Push Docker image to registries
2023-03-20 20:14:41 -04:00
30d4c41eee Added repo auth
Some checks failed
Push Docker image to registries
2023-03-20 20:11:22 -04:00
fadc678ac3 Fixed pipeline trigger
Some checks failed
Push Docker image to registries
2023-03-20 20:01:52 -04:00
9b06a629f0 Added gitea runner 2023-03-20 19:58:20 -04:00
6 changed files with 47 additions and 90 deletions

View File

@ -0,0 +1,36 @@
# .gitea/workflows/build.yaml
name: Publish Docker image
on:
push:
branches: [main]
jobs:
push_to_registry:
name: Push Docker image to registries
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
with:
token: ${{ secrets.GITEA_TOKEN }}
- name: Login to DockerHub
uses: https://github.com/docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Login to Gitea registry
uses: https://github.com/docker/login-action@v2
with:
registry: git.kizaing.ca
username: ${{ gitea.actor }}
password: ${{ secrets.GITEA_TOKEN }}
- name: Build and push Docker image
uses: https://github.com/docker/build-push-action@v4
with:
context: .
push: true
tags: git.kizaing.ca/kizaing/teletok:latest, kizaing

View File

@ -1,14 +0,0 @@
using System;
using System.Configuration;
using Matrix.Sdk;
namespace TeleTok
{
public class MatrixListener
{
public void RunListener()
{
}
}
}

View File

@ -10,85 +10,27 @@ namespace TeleTok
.AddJsonFile("config.json", true) .AddJsonFile("config.json", true)
.Build(); .Build();
// Value to see what bot mode to run in
public static string botMode = config.GetSection("TeleTokConf:botMode").Value;
// Telegram bot config
public static string token = config.GetSection("TeleTokConf:token").Value; public static string token = config.GetSection("TeleTokConf:token").Value;
public static string ptInstance = config.GetSection("TeleTokConf:ptInstance").Value; public static string ptInstance = config.GetSection("TeleTokConf:proxitokInstance").Value;
// Matrix bot config
public static string matrixAddress = config.GetSection("TeleTokConf:matrixAddress").Value;
public static string mBotUser = config.GetSection("TeleTokConf:mBotUser").Value;
public static string mBotPass = config.GetSection("TeleTokConf:mBotPass").Value;
static async Task Main(string[] args) static async Task Main(string[] args)
{ {
//Checks to see what mode to run the bot in //Checks if the config json data is valid
if(token == "" || token == null || token == "INSERT TOKEN HERE")
if(botMode == "telegram")
{ {
//Checks if the config json data is valid LogMessage("Telegram bot token is invalid! Exiting...");
if(ConfigCheck(token) == false)
{
LogMessage("Telegram bot token is invalid! Exiting...");
}
else if(ConfigCheck(ptInstance) == false)
{
LogMessage("Proxitok instance is invalid! Exiting...");
}
else
{
TelegramListener tListener = new TelegramListener();
LogMessage("Now listening...");
tListener.RunListener();
}
} }
else if(botMode == "matrix") else if(ptInstance == "" || ptInstance == null || ptInstance == "PROXITOK INSTANCE URL")
{ {
//Checks if the config json data is valid LogMessage("Proxitok instance is invalid! Exiting...");
if(ConfigCheck(matrixAddress) == false)
{
LogMessage("Synapse address is invalid! Exiting...");
}
else if(ConfigCheck(mBotUser) == false)
{
LogMessage("Matrix bot username is invalid! Exiting...");
}
else if(ConfigCheck(mBotPass) == false)
{
LogMessage("Matrix bot password is invalid! Exiting...");
}
else
{
MatrixListener mListener = new MatrixListener();
LogMessage("Now listening...");
mListener.RunListener();
}
} }
else else
{ {
LogMessage("Bot mode is not configured! Enter either \'telegram\' or \'matrix\'"); TelegramListener listener = new TelegramListener();
} LogMessage("Now listening...");
}
public static bool ConfigCheck(string confItem) listener.RunListener();
{ }
if(confItem == "" || confItem == null
|| confItem == "INSERT TOKEN HERE"
|| confItem == "PROXITOK INSTANCE URL"
|| confItem == "SYNAPSE SERVER URL"
|| confItem == "MATRIX BOT USERNAMEL"
|| confItem == "MATRIX BOT PASSWORD")
{
return false;
}
else
{
return true;
}
} }
public static void LogMessage(string text) public static void LogMessage(string text)

View File

@ -1,5 +1,3 @@
[![Build Status](https://ci.kizaing.ca/api/badges/kizaing/TeleTok/status.svg)](https://ci.kizaing.ca/kizaing/TeleTok)
# TeleTok Telegram Bot # TeleTok Telegram Bot
This bot will monitor any chats for TikTok links that are posted, and then will run the link through a [ProxiTok](https://github.com/pablouser1/ProxiTok) instance to generate a download link. The resulting video file will then get directly uploaded directly to your chat. This bot will monitor any chats for TikTok links that are posted, and then will run the link through a [ProxiTok](https://github.com/pablouser1/ProxiTok) instance to generate a download link. The resulting video file will then get directly uploaded directly to your chat.

View File

@ -8,7 +8,6 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Matrix.Sdk" Version="1.0.7" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.2" /> <PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
<PackageReference Include="Telegram.Bot" Version="17.0.0" /> <PackageReference Include="Telegram.Bot" Version="17.0.0" />

View File

@ -1,10 +1,6 @@
{ {
"TeleTokConf": { "TeleTokConf": {
"botMode": "telegram",
"token": "INSERT TOKEN HERE", "token": "INSERT TOKEN HERE",
"ptInstance": "PROXITOK INSTANCE URL", "proxitokInstance": "PROXITOK INSTANCE URL"
"matrixAddress": "SYNAPSE SERVER URL",
"mBotUser": "MATRIX BOT USERNAME",
"mBotPass": "MATRIX BOT PASSWORD"
} }
} }