Giter VIP home page Giter VIP logo

randombot's Introduction

RandomBot

This is a Telegram bot that enables you to generate some kind of pseudorandom values. For example, it has functionality for virtual "rolling the dice", "flipping coin", choice between set of options, etc.

Requirements

  • Golang compiler (with 1.13 or higher version)
  • Docker CLI
  • Redis (you may install it via Docker)

How to launch locally

  • Install a Redis server:

    docker run --name redis-test-instance -p 6379:6379 -d redis
  • Start the Redis server:

    docker start redis-test-instance
  • Create a .env file and define Telegram token parameter:

    RANDOM_BOT_TELEGRAM_TOKEN=<your token>
  • Build and launch an application

How to build

Building with Docker

Run the following command:

docker build -t <build tag> .

You will get an application image. Then if need to run it, use "docker run" command. For example:

docker run --name redis-test-instance <build tag> \
    -e RANDOM_BOT_TELEGRAM_TOKEN=<token>

Building with Golang compiler

Run the following command:

go build

You will get an executable file with name "main".

Launching the application:

./main

Localization

Translating new strings

  • Find new strings to translate:

    goi18n extract -outdir locale/assets
    goi18n merge -outdir locale/assets locale/assets/active.*.toml

    You will get "translate.<language code>.toml" files with strings that translations need to be updated.

  • Edit translations files

  • Merge the translations into active files:

    goi18n merge -outdir locale/assets locale/assets/active.*.toml locale/assets/translate.*.toml
  • (Optional) Remove "translate.*.toml" files:

    rm locale/assets/translate.*.toml

Translating new language

  • Generate a file with all strings to translate:

    goi18n extract -outdir locale/assets -sourceLanguage <language code>
  • Edit the translations file

  • Merge translations (this command will append hash codes of the strings):

    goi18n merge -outdir locale/assets locale/assets/active.*.toml

randombot's People

Contributors

programminglanguageleader avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.