Skip to content

Commit

Permalink
Merge pull request #277 from RITlug/go-port
Browse files Browse the repository at this point in the history
go-port -> master: The Saga of the Big Merge
  • Loading branch information
jwflory authored Mar 27, 2020
2 parents a774530 + dc4e1b4 commit 1626cb5
Show file tree
Hide file tree
Showing 91 changed files with 723 additions and 6,451 deletions.
17 changes: 0 additions & 17 deletions .codeclimate.yml

This file was deleted.

7 changes: 3 additions & 4 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
teleirc.service
README.md
LICENSE
containers/Dockerfile*
containers/docker-compose*
node_modules*
tests/*
build/Dockerfile*
deployments/docker-compose.yml
tests/*
42 changes: 11 additions & 31 deletions .gitignore
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
18 changes: 0 additions & 18 deletions .jsbeautifyrc

This file was deleted.

40 changes: 22 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,35 @@
---
os: linux
dist: bionic
jobs:
include:
- language: node_js
node_js:
- 8
- 10
cache:
npm: false
yarn: false
- language: go
go: 1.12.x
before_install: "curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin $GOLANGCI_LINT_VERSION"
script: "golangci-lint run"

addons:
apt:
update: true
packages:
- libicu-dev
- language: go
go: 1.13.x
before_install: "curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin $GOLANGCI_LINT_VERSION"
script: "golangci-lint run"

before_install: cp env.example .env
install:
- yarn
- yarn global add nodeunit
script: yarn test
- language: go
go: master
before_install: "curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin $GOLANGCI_LINT_VERSION"
script: "golangci-lint run"

- language: python
python: 3.7
cache: pip
before_install: cd docs/
install: pipenv install --dev
install: "pip install $(pipenv lock --requirements)"
script: sh build_docs.sh

env:
global:
- GO111MODULE: "on"
- GOLANGCI_LINT_VERSION: "v1.23.8"

notifications:
irc:
channels:
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
TeleIRC
=======

<a href="https://github.com/RITlug/teleirc"><img src="/brand/svg/horizontal_color.svg" alt="TeleIRC logo by Ura Design" width="60%" height="auto"></a>
<a href="https://github.com/RITlug/teleirc"><img src="/assets/svg/horizontal_color.svg" alt="TeleIRC logo by Ura Design" width="60%" height="auto"></a>

[![Build Status](https://travis-ci.org/RITlug/teleirc.svg?branch=devel)](https://travis-ci.org/RITlug/teleirc)
[![Documentation Status](https://readthedocs.org/projects/teleirc/badge/?version=latest)](http://docs.teleirc.com/en/latest/?badge=latest)
[![Maintainability](https://api.codeclimate.com/v1/badges/f26acd099b16fce789b3/maintainability)](https://codeclimate.com/github/RITlug/teleirc/maintainability)

NodeJS implementation of a [Telegram](https://telegram.org/) <=> [IRC](https://en.wikipedia.org/wiki/Internet_Relay_Chat) bridge for use with any IRC channel and Telegram group
Go implementation of a [Telegram](https://telegram.org/) <=> [IRC](https://en.wikipedia.org/wiki/Internet_Relay_Chat) bridge for use with any IRC channel and Telegram group


## About

**RITlug TeleIRC** is a NodeJS implementation of a [Telegram](https://telegram.org/) <=> [IRC](https://en.wikipedia.org/wiki/Internet_Relay_Chat) bridge.
**RITlug TeleIRC** is a Go implementation of a [Telegram](https://telegram.org/) <=> [IRC](https://en.wikipedia.org/wiki/Internet_Relay_Chat) bridge.
TeleIRC works with any IRC channel and Telegram group.
It bridges messages between a Telegram group and an IRC channel.

Expand Down
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.
58 changes: 58 additions & 0 deletions cmd/teleirc.go
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)
}
}
40 changes: 0 additions & 40 deletions config.js

This file was deleted.

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.
15 changes: 2 additions & 13 deletions env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

IRC_BLACKLIST=""
IRC_BOT_NAME=teleirc
IRC_CHANNEL=#channel
IRC_CHANNEL="#channel"
IRC_CHANNEL_KEY=""
IRC_SEND_STICKER_EMOJI=true
IRC_SEND_DOCUMENT=false
Expand Down Expand Up @@ -47,15 +47,4 @@ TELEGRAM_CHAT_ID=-0000000000000
###############################################################################

USE_IMGUR_FOR_IMAGES=true
IMGUR_CLIENT_ID=0000000000


###############################################################################
# #
# Misc. required env variables #
# -- not meant for user config, don't touch -- #
# #
###############################################################################

# https://github.com/yagop/node-telegram-bot-api/issues/319#issuecomment-324963294
NTBA_FIX_319=1
IMGUR_CLIENT_ID=7d6b00b87043f58
17 changes: 17 additions & 0 deletions go.mod
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
)
27 changes: 27 additions & 0 deletions go.sum
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=
Loading

0 comments on commit 1626cb5

Please sign in to comment.