README.md 3.0 KB

About

GoEthemineTelegramBot is attempt to port EthemineTelegramBotCore into Golang.

Why?

  • For ease of maintain project further with backward compatibility with EthemineTelegramBotCore to use the same MySQL database.
  • Creating simple and easy to use docker or potman container for fast deployment
  • Practice in work with Go

Progress

Face to face porting

  • AppSettings.cs - settings.go
  • DataUpdater.cs Updater in main.go
  • EFDatabase.cs - Not needed: analog - models.go
  • JsonDownloader.cs - unmasrshal_url.go
    • JsonCurrentStats.cs - in api_structs.go
    • JsonNetworkStats.cs - in api_structs.go
    • JsonPayouts.cs - in api_structs.go
    • JsonWorker.cs - in api_structs.go
    • Logger.cs
    • Program.cs
  • Main - Fully ported needs testing
    • BotOnMessage
    • GetActualRate
    • GetActualData
    • GetActualDataFromDatabase
    • AddUser
    • SetWallet
    • DeleteUser
    • SendHelp
    • GetLastPayout
    • UpdateData.cs - Fully ported needs testing

Usadge

As for now where are no releases for GoEthemineTelegramBot, so to run it you need to compile it by yourself. It's easy you will see.

Compiling from source

Simply run following commands depending on your OS in project's root directory:

Linux/Mac

# go build -o GoEthemineTelegramBot .

Windows

> go build -o GoEthemineTelegramBot.exe .

First launch

As for first launch you dont need to specify anything, just start the bot:

Linux/Mac

# ./GoEthemineTelegramBot

Windows

> GoEthemineTelegramBot.exe

GoEthemineTelegramBot will generate config template config.json in its working directory. With this stucture:

{
  "Token": "",
  "ApiUrl": "",
  "DbHost": "",
  "DbName": "",
  "FullLogPath": "",
  "ErrorLogPath": "",
  "Currency": ""
}

Fill the brackets with settings suitable for you. Example:

{
  "Token": "idontsayyoumytopsecrettelegrambottokennever",
  "ApiUrl": "https://api.ethermine.org",
  "DbHost": "127.0.0.1",
  "DbName": "telegrambotdb",
  "FullLogPath": "logs\full.log",
  "ErrorLogPath": "logs\error.log",
  "Currency": "ETH"
}
Note

Make sure to create schema with right* tables at your server: GoEthemineTelegramBot can't create or check if tables structure right or not on it's own ... for now!

*I will not say you what is right

Normal launch

After launch GoEthemineTelegramBot will ask you for username and password for specified database. You can skip it by launching it with arguments like this:

Linux/Mac

# ./GoEthemineTelegramBot username password

Windows

> GoEthemineTelegramBot.exe username password

Stopping bot

I will not stop you from stopping bot with Ctrl+C. But I should say that you could stop bot by pressing Enter. I never stop the bot this way thou.