Applied rubocop.
This commit is contained in:
parent
f9590999c2
commit
dd6974963c
1 changed files with 10 additions and 12 deletions
|
@ -35,7 +35,7 @@ returns
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def self.set_webhook(token, callback_url)
|
def self.set_webhook(token, callback_url)
|
||||||
if callback_url =~ /^http:\/\//i
|
if callback_url =~ %r{^http://}i
|
||||||
raise 'webhook url need to start with https://, you use http://'
|
raise 'webhook url need to start with https://, you use http://'
|
||||||
end
|
end
|
||||||
api = TelegramAPI.new(token)
|
api = TelegramAPI.new(token)
|
||||||
|
@ -72,9 +72,8 @@ returns
|
||||||
|
|
||||||
if params[:group_id].blank?
|
if params[:group_id].blank?
|
||||||
raise 'Group needed!'
|
raise 'Group needed!'
|
||||||
else
|
|
||||||
group = Group.find_by(id: params[:group_id])
|
|
||||||
end
|
end
|
||||||
|
group = Group.find_by(id: params[:group_id])
|
||||||
if !group
|
if !group
|
||||||
raise 'Group invalid!'
|
raise 'Group invalid!'
|
||||||
end
|
end
|
||||||
|
@ -355,11 +354,10 @@ returns
|
||||||
last_width = file['width'].to_i
|
last_width = file['width'].to_i
|
||||||
last_height = file['height'].to_i
|
last_height = file['height'].to_i
|
||||||
end
|
end
|
||||||
if file['width'].to_i < max_width && last_width < file['width'].to_i
|
next unless file['width'].to_i < max_width && last_width < file['width'].to_i
|
||||||
photo = file
|
photo = file
|
||||||
last_width = file['width'].to_i
|
last_width = file['width'].to_i
|
||||||
last_height = file['height'].to_i
|
last_height = file['height'].to_i
|
||||||
end
|
|
||||||
}
|
}
|
||||||
if last_width > 650
|
if last_width > 650
|
||||||
last_width = (last_width / 2).to_i
|
last_width = (last_width / 2).to_i
|
||||||
|
@ -470,12 +468,12 @@ returns
|
||||||
|
|
||||||
# send welcome message and don't create ticket
|
# send welcome message and don't create ticket
|
||||||
text = params[:message][:text]
|
text = params[:message][:text]
|
||||||
if text.present? && text =~ /^\/start/
|
if text.present? && text =~ %r{^/start}
|
||||||
message(params[:message][:chat][:id], channel.options[:welcome] || 'You are welcome! Just ask me something!')
|
message(params[:message][:chat][:id], channel.options[:welcome] || 'You are welcome! Just ask me something!')
|
||||||
return
|
return
|
||||||
|
|
||||||
# find ticket and close it
|
# find ticket and close it
|
||||||
elsif text.present? && text =~ /^\/end/
|
elsif text.present? && text =~ %r{^/end}
|
||||||
user = to_user(params)
|
user = to_user(params)
|
||||||
ticket = Ticket.where(customer_id: user.id).order(:updated_at).first
|
ticket = Ticket.where(customer_id: user.id).order(:updated_at).first
|
||||||
ticket.state = Ticket::State.find_by(name: 'closed')
|
ticket.state = Ticket::State.find_by(name: 'closed')
|
||||||
|
@ -542,8 +540,8 @@ returns
|
||||||
url,
|
url,
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
open_timeout: 20,
|
open_timeout: 20,
|
||||||
read_timeout: 40,
|
read_timeout: 40,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue