-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #277 from RITlug/go-port
go-port -> master: The Saga of the Big Merge
- Loading branch information
Showing
91 changed files
with
723 additions
and
6,451 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,36 @@ | ||
# ---------------------------------- Docker ------------------------------------ | ||
|
||
# Example Dockerfiles exist in `containers/`. Copy the base image of your choice | ||
# Example Dockerfiles exist in `build/`. Copy the base image of your choice | ||
# to the project root directory as `Dockerfile`. Choose which image suits your | ||
# needs or preferences. | ||
Dockerfile | ||
|
||
# Docker Compose file | ||
# Remove when image is pushed to Docker Hub or similar | ||
docker-compose.yml | ||
# ----------------------------- Python ------------------------------ | ||
|
||
# Sphinx docs output | ||
docs/_build | ||
|
||
# Allow teleirc's lib, which would otherwise be ignored from the python Virtualenv | ||
# ignores above | ||
!/lib/ | ||
|
||
|
||
# ----------------------------------- Node ------------------------------------- | ||
# ----------------------------------- Miscellaneous ------------------------------------- | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directory | ||
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git | ||
node_modules | ||
# IDE metadata | ||
.vscode | ||
|
||
# Running config file! Don't commit this unless you know what you're doing. | ||
.env | ||
|
||
|
||
# ----------------------------- Python (for docs) ------------------------------ | ||
|
||
# Sphinx docs output | ||
docs/_build | ||
|
||
# Generated executables | ||
teleirc | ||
cmd/cmd |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Package main contains all logic relating to running TeleIRC | ||
package main | ||
|
||
import ( | ||
"flag" | ||
"os" | ||
|
||
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api" | ||
"github.com/ritlug/teleirc/internal" | ||
"github.com/ritlug/teleirc/internal/handlers/irc" | ||
tg "github.com/ritlug/teleirc/internal/handlers/telegram" | ||
) | ||
|
||
const ( | ||
version = "v2.0" | ||
) | ||
|
||
var ( | ||
flagPath = flag.String("conf", ".env", "config file") | ||
flagDebug = flag.Bool("debug", false, "disable debugging") | ||
flagVersion = flag.Bool("version", false, "displays current version of TeleIRC") | ||
) | ||
|
||
func main() { | ||
flag.Parse() | ||
|
||
debug := internal.Debug { DebugLevel: *flagDebug } | ||
|
||
if *flagVersion { | ||
debug.PrintVersion("Current TeleIRC version: " + version) | ||
return | ||
} | ||
|
||
// Notify that debug is enabled | ||
debug.LogInfo("Debug mode enabled!") | ||
|
||
settings, err := internal.LoadConfig(*flagPath) | ||
if err != nil { | ||
debug.LogError(err) | ||
os.Exit(1) | ||
} | ||
|
||
var tgapi *tgbotapi.BotAPI | ||
tgClient := tg.NewClient(settings.Telegram, tgapi, debug) | ||
tgChan := make(chan error) | ||
|
||
ircClient := irc.NewClient(settings.IRC, debug) | ||
ircChan := make(chan error) | ||
go ircClient.StartBot(ircChan, tgClient.SendMessage) | ||
go tgClient.StartBot(tgChan, ircClient.SendMessage) | ||
|
||
select { | ||
case ircErr := <-ircChan: | ||
debug.LogError(ircErr) | ||
case tgErr := <-tgChan: | ||
debug.LogError(tgErr) | ||
} | ||
} |
5 changes: 3 additions & 2 deletions
5
images/docker-compose.yml.example → deployments/docker-compose.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
# -*- mode: yaml-*- | ||
# vim: ft=yaml | ||
|
||
version: '2' | ||
version: '3' | ||
|
||
services: | ||
teleirc: | ||
build: | ||
context: .. | ||
dockerfile: images/Dockerfile.alpine | ||
dockerfile: build/Dockerfile.alpine | ||
env_file: ../.env | ||
user: teleirc |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module github.com/ritlug/teleirc | ||
|
||
go 1.12 | ||
|
||
require ( | ||
github.com/caarlos0/env/v6 v6.0.0 | ||
github.com/go-playground/locales v0.12.1 // indirect | ||
github.com/go-playground/universal-translator v0.16.0 // indirect | ||
github.com/go-playground/validator v9.29.1+incompatible | ||
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible | ||
github.com/joho/godotenv v1.3.0 | ||
github.com/leodido/go-urn v1.1.0 // indirect | ||
github.com/lrstanley/girc v0.0.0-20190801035559-4fc93959e1a7 | ||
github.com/stretchr/testify v1.3.0 | ||
github.com/technoweenie/multipartstreamer v1.0.1 // indirect | ||
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
github.com/caarlos0/env/v6 v6.0.0 h1:NZt6FAoB8ieKO5lEwRdwCzYxWFx7ZYF2R7UcoyaWtyc= | ||
github.com/caarlos0/env/v6 v6.0.0/go.mod h1:+wdyOmtjoZIW2GJOc2OYa5NoOFuWD/bIpWqm30NgtRk= | ||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= | ||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
github.com/go-playground/locales v0.12.1 h1:2FITxuFt/xuCNP1Acdhv62OzaCiviiE4kotfhkmOqEc= | ||
github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= | ||
github.com/go-playground/universal-translator v0.16.0 h1:X++omBR/4cE2MNg91AoC3rmGrCjJ8eAeUP/K/EKx4DM= | ||
github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY= | ||
github.com/go-playground/validator v9.29.1+incompatible h1:KzeWOnoPKd5L5RG0JlVFwkdsVX9QpQdSdmTtcn7nLU8= | ||
github.com/go-playground/validator v9.29.1+incompatible/go.mod h1:yrEkQXlcI+PugkyDjY2bRrL/UBU4f3rvrgkN3V8JEig= | ||
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible h1:2cauKuaELYAEARXRkq2LrJ0yDDv1rW7+wrTEdVL3uaU= | ||
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible/go.mod h1:qf9acutJ8cwBUhm1bqgz6Bei9/C/c93FPDljKWwsOgM= | ||
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= | ||
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= | ||
github.com/leodido/go-urn v1.1.0 h1:Sm1gr51B1kKyfD2BlRcLSiEkffoG96g6TPv6eRoEiB8= | ||
github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw= | ||
github.com/lrstanley/girc v0.0.0-20190801035559-4fc93959e1a7 h1:BS9tqL0OCiOGuy/CYYk2gc33fxqaqh5/rhqMKu4tcYA= | ||
github.com/lrstanley/girc v0.0.0-20190801035559-4fc93959e1a7/go.mod h1:liX5MxHPrwgHaKowoLkYGwbXfYABh1jbZ6FpElbGF1I= | ||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= | ||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= | ||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= | ||
github.com/technoweenie/multipartstreamer v1.0.1 h1:XRztA5MXiR1TIRHxH2uNxXxaIkKQDeX7m2XsSOlQEnM= | ||
github.com/technoweenie/multipartstreamer v1.0.1/go.mod h1:jNVxdtShOxzAsukZwTSw6MDx5eUJoiEBsSvzDU9uzog= | ||
gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= | ||
gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= |
Oops, something went wrong.