GithubHelp home page GithubHelp logo

quiz-bot's Introduction

Quiz bot

Bot quiz for Telegram and VK. It uses text files to load questions and bot to ask its. Also, it uses Redis cloud databases to save intermediate results.

To find bot in TG: @dvmn_quiz_bot

Commands for Telegram's bot:

  1. /start – start quiz
  2. /help – about this bot
  3. /exit, /cancel – quit game

Telegram-2019-08-09-18-14-21.png

To start in VK, type начать, старт, start To stop in VK, type закончить, стоп, stop, end

2019-08-09-18-17-21.png

How to install

  1. Create a bot in Telegram @via BotFather, and get it API token.
  2. Create redis account in Redislabs, and after that create cloud database (you can choose free plan). Get your endpoint database url and port.
  3. Create VK's group, allow it send messages, and get access token for it.

Create .env file in the root directory and fill it:

TG_TOKEN=your tg bot token
REDIS_DATABASE=redis database endpoint without port
REDIS_PORT=redis database port
REDIS_PSWRD=redis password
VK_TOKEN=vk access token

Python3 must be already installed.

Should use virtual env for project isolation.

Then use pip (or pip3, if there is a conflict with Python2) to install dependencies:

pip install -r requirements.txt

How add new questions for bots

To create new questions, you must create a folder into the root directory and call it quiz-questions. After that, create new txt files with KOI8-R encoding and write into it new questions and answers separating them two spaces.

File for example:

Вопрос 1:
С одним советским туристом в Марселе произошел такой случай. Спустившись
из своего номера на первый этаж, он вспомнил, что забыл закрутить кран в
ванной. Когда он поднялся, вода уже затопила комнату. Он вызвал
горничную, та попросила его обождать внизу. В страхе он ожидал расплаты
за свою оплошность. Но администрация его не ругала, а, напротив,
извинилась сама перед ним. За что?

Ответ:
За то, что не объяснила ему правила пользования кранами.


Вопрос:
Средневековый обычай: рыцаря, совершившего поступок, порочащий честь,
заставляли пробежать некоторую дистанцию, положив ему на спину седло,
мешок с камнями или... Кого?

Ответ:
Собаку. Отсюда, по одной из версий, происходит выражение "навешать
собак".


Вопрос:
Цветы этого декоративного растения семейства крестоцветных могут иметь
самую разнообразную окраску, хотя судя по его названию, они обязательно
должны быть белыми. Назовите это растение.

Ответ:
Левкой (от греческого leukos - белый).

Or you can download questions and unzip archive in the root.

How to use

To run Telegram bot:

python tg_bot.py

To run VK bot:

python vk_bot.py

quiz-bot's People

Contributors

alpden550 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.