Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
supcik committed Aug 11, 2016
1 parent 4fbe0a3 commit a7ba295
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 17 deletions.
27 changes: 22 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
language: go
notifications:
email:
recipients: [email protected]
on_success: change
on_failure: always

go:
- 1.6

install:
- go get ./...
- go build

script:
- file telecom-tower-telegram-bot
- true

deploy:
provider: releases
api_key:
secure: HFrfvOaH8FU91LXYN1/ocn42pt/Bvsbzt+EQXhZ7Kg9mF+9eN3p+91+5GgxeEJNvVamO8g5trJzI/E0rToPye0/5PTK3RoVz6lBREsOP6tzSqjMMhyYLoFQ2eUcKt9yelZfILdLr8OmVRpHIx139Owz694ndNwzY48iJHqnUDVDKONuax9HbMkLIymgzYXga92UVTqGOcCLpvcE9Nk1KhE4FV8aVa8493wzYc/oF3w2vtvSx4FY5tWvqq42VL0tlxf2gbK9dFsF1nk9yPKaaIhxmaKIBFlylLAA5jvpOEtI++xR2orXv8C3UvQK6d9nJmuba3L1WKuk0wmNu8y2eMO5MPIBYugDvD4hsGEz3rRrcJoGzBYp61KqDFoSS6736pPFm3pRMwsi3ZI7/FHy+VQZKPcOc1MChcQ7bv03TRc1dKcaiOudpFJc2fI3Nd1AUCr6tvBKeJi3Y+YNDMrQHMJkF63x094Zi2cQOci1vXKetdXyAU1LFBn/SmQwlJRBVSShikYZh1ChxeHyk3IbHvD+mg6Dhf+mAxFw8qKfeQtamjgtzZsGTas3wNRdE+K0jFBWO4Ox3DV7wkEb5oSeJhHP3DhjWxDmasPxBEB8kJp0jz+0j8AQIciaXY8iBP0/+kw6xBxqcTDR+w9QGZGCD9CjX3euYi7xcSBxibQ7O5HA=
file: telecom-tower-telegram-bot
skip_cleanup: true
overwrite: true
on:
repo: heia-fr/telecom-tower-telegram-bot
tags: true
22 changes: 11 additions & 11 deletions telecom-tower-telegram-bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import (
"github.com/nats-io/nats"
"github.com/tucnak/telebot"
"github.com/vharitonsky/iniflags"
"github.com/zabawaba99/firego"
"github.com/BlueMasters/firebasedb"
"net/http"
"strings"
"time"
Expand All @@ -75,7 +75,7 @@ var notificationChannels = [...]string{"telecom_tower_notifications"}

var bot *telebot.Bot
var sessions = make(map[string]*session) // the key is the telegram chat ID and the user ID
var fbase *firego.Firebase
var fbase firebasedb.Reference

func dispatchMessage(sender, text, color string) {
msg := rollrenderer.TextMessage{
Expand Down Expand Up @@ -104,14 +104,11 @@ func dispatchMessage(sender, text, color string) {
saveMessage(msg)
bitmap := rollrenderer.RenderMessage(&msg)

fbaseData := make(map[string]interface{})

fbaseData["currentMessage"] = msg
fbaseData["currentBitmap"] = bitmap
fbaseData["Coucou"] = "C'est nous."

if err := fbase.Ref("currentMessage").Set(&msg); err != nil {
log.Info(err)
}

if err := fbase.Set(fbaseData); err != nil {
if err := fbase.Ref("currentBitmap").Set(&bitmap); err != nil {
log.Info(err)
}

Expand Down Expand Up @@ -240,8 +237,11 @@ func main() {
}

// Connect to Firebase Database
fbase = firego.New(*fireBaseURL, nil)
fbase.Auth(*fireBaseToken)
fbase, err = firebasedb.NewFirebaseDB(*fireBaseURL)
if err != nil {
log.Fatalf("Error opening firebase: %s", err)
}
fbase = fbase.Auth(*fireBaseToken)

bot, err = telebot.NewBot(*token)
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion telecom-tower-telegram-bot.ini

This file was deleted.

0 comments on commit a7ba295

Please sign in to comment.