61a42e63b4
[UPD] Now gracefully closes all Telegram and XMPP connections when SIGINT received. I do not fucking know how to deal with memory leaks in Ruby. I tried literally everything. Unloading TD class, forcing garbage collection, et cetera — nothing helps, it just runs a gig in two days. So, now we have to kill -INT our transport every... six hours, for example, and monitor/reconnect (for example with systemd). Fuck ruby & tdlib. Hate.
19 lines
453 B
Ruby
19 lines
453 B
Ruby
# Some very important libraries'
|
|
require 'yaml'
|
|
require 'logger'
|
|
require 'xmpp4r'
|
|
require 'digest'
|
|
require 'base64'
|
|
require 'sqlite3'
|
|
require 'tdlib-ruby'
|
|
require_relative 'inc/telegramclient'
|
|
require_relative 'inc/xmppcomponent'
|
|
|
|
# configuration
|
|
Config = YAML.load_file(File.dirname(__FILE__) + '/config.yml')
|
|
TelegramClient.configure(Config['telegram']) # configure tdlib
|
|
|
|
# run
|
|
Zhabogram = XMPPComponent.new(Config['xmpp'])
|
|
Zhabogram.connect()
|