Project

iii_api

0.0
No commit activity in last 3 years
No release in over 3 years
Simple ruby api for using iii.ru bot
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
>= 0
>= 0
>= 0

Runtime

 Project Readme

IiiApi

Simple ruby gem for using iii.ru (russian speaking bot)

Installation

Add this line to your application's Gemfile:

gem 'iii_api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install iii_api

Usage

Create and customise new bot at iii.ru, save it's unique id from url (e.g. 6de4ced8-434b-4803-8b46-32a64b92eb8a)

Initialize new chat room with your bot id and some unique id:

bot = IiiApi::Bot.new('6de4ced8-434b-4803-8b46-32a64b92eb8a', 'some-valid-uri-as-chat-id')

You can now access your iii.ru chat id as bot.chat_id

If you want to reuse it later, you can save it and initialize bot with it:

save_id_somewhere = bot1.chat_id
...
bot2 = IiiApi::Bot.new(save_id_somewhere)

Finally, just call the ask method with your message and receive answer:

bot.ask('Как дела?') # 'Пасиб. Нормально. Ты-то как?'

You may want to sanitize returned value, as sometimes it contains tags. Just use some third party libraries for this. For example: ActionView::Base.full_sanitizer.sanitize(returned_string)

Contributing

  1. Fork it ( https://github.com/GriwMF/iii_api/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request