Git Product home page Git Product logo

python-treasurehunt-bot's Introduction

Python Threasure Hung Bot

A treasure hunt telegram bot written in python

Image of Yaktocat

Instructions

1. Install dependencies.

Install python requirements using pip: pip install -r requirements.txt.

2. Config file

Create config files with the following schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "TOKEN_BOT": {
      "type": "string"
    },
    "authorized_users": {
      "type": "array",
      "items": {
        "type": "integer"
      }
    },
    "logging_user": {
      "type": "integer"
    },
    "unauthorized_user_msg": {
      "type": "string"
    },
    "start_game_msg": {
      "type": "string"
    },
    "finish_game_msg": {
      "type": "string"
    },
    "states": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "oneOf": [
                "position",
                "text"
            ]
          },
          "init_msg": {
            "type": "string"
          },
          "help_msg": {
            "type": "string"
          },
          "target_position": {
            "type": "array",
            "items": {
              "type": "number"
            }
          },
          "max_distance": {
            "type": "integer"
          },
          "wrong_position_reply": {
            "type": "string"
          },
          "question": {
            "type": "string"
          },
          "answer": {
            "type": "string"
          },
          "wrong_answer_reply: {
            "type": "string"
          },
          "on_exit_reply": {
            "type": "string"
          }
        },
        "required": [
          "type",
          "init_msg",
          "help_msg",
          "target_position", "max_distance", "wrong_position_reply", (for states with type "position")
          "question, "answer, "wrong_answer_reply (for state with type "text")
          "on_exit_reply"
        ]
      }
    }
  },
  "required": [
    "TOKEN_BOT",
    "authorized_users",
    "logging_user",
    "unauthorized_user_msg",
    "start_game_msg",
    "finish_game_msg",
    "states"
  ]
}

Here an example:

{
  "TOKEN_BOT": "token",
  "authorized_users": [12345678, 87654321],
  "logging_user":12345679,
  "unauthorized_user_msg": "Im'sorry but you can't use this bot!",
  "start_game_msg": "Hi! Welcome to treasure hunt bot. Start the game!",
  "finish_game_msg": "Great! you finish the game!",
  "states": [
    {
      "type": "position",
      "init_msg": "Go to Time Square to continue the game",
      "help_msg": "Go to New York first and you're near enough to go to Time Square :)",
      "target_position": [40.758895,-73.98513100000002],
      "max_distance": 100,
      "wrong_position_reply": "You are %d meters to the target position",
      "on_exit_reply": "Great go to the next step"
    },
    {
      "type":"text",
      "init_msg": "Here your question",
      "help_msg": "If you ask an help you're not so smart :)",
      "question": "What color was Napoleon's white horse?",
      "answer": "white",
      "on_exit_reply": "",
      "wrong_answer_reply": "Come on! Who doesn't known Napoleon's white horse?"
    },
    ...
  ]
}

Deploy to Heroku

This repo has all requested files to deploy the application on Heroku!

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.