telegram-history-dump
telegram-history-dump copied to clipboard
no implicit conversion of String into Integer (TypeError)
I am using the patch from https://github.com/tvdstaaij/telegram-history-dump/pull/61 but from what I saw, it doesn't seem that this part was modified by the patch:
I, [2017-01-31T15:41:09.421861 #13743] INFO -- : Dumping "channel#1" (range 7111-7120)
./telegram-history-dump.rb:193:in `[]': no implicit conversion of String into Integer (TypeError)
from ./telegram-history-dump.rb:193:in `block in process_media'
from ./telegram-history-dump.rb:164:in `each'
from ./telegram-history-dump.rb:164:in `process_media'
from ./telegram-history-dump.rb:139:in `block in dump_dialog'
from ./telegram-history-dump.rb:104:in `reverse_each'
from ./telegram-history-dump.rb:104:in `dump_dialog'
from ./telegram-history-dump.rb:366:in `block in <main>'
from ./telegram-history-dump.rb:362:in `each'
from ./telegram-history-dump.rb:362:in `each_with_index'
from ./telegram-history-dump.rb:362:in `<main>'
Line 193 is response['result']
after the else
in this block:
def process_media(dialog, msg)
return unless msg.include?('media')
%w(document video photo audio).each do |media_type|
next unless $config['download_media'][media_type]
next unless msg['media']['type'] == media_type
response = nil
Timeout::timeout($config['media_timeout']) do
begin
response = exec_tg_command('load_' + media_type, msg['id'])
rescue StandardError => e
$log.error('Failed to download media file: %s' % e)
return
end
end
filename = case
when $config['copy_media']
if response.nil?
$log.error('Missing media for message id %s' % msg['id'])
"missing_media_%s" % msg['id']
else
begin
filename = File.basename(response['result'])
destination = File.join(get_media_dir(dialog), fix_media_ext(filename))
FileUtils.cp(response['result'], destination)
destination
rescue StandardError => e
$log.error('Missing media for message id %s' % msg['id'])
"missing_media_%s" % msg['id']
end
end
else
response['result'] # <--- HERE
end
begin
File.delete(response['result']) if $config['delete_media']
rescue StandardError => e
$log.error('Failed to delete media file: %s' % e)
end
msg['media']['file'] = filename if filename
end
end
This should have been solved by #71 which is now merged, could you retry with latest master
?