CallbackQuery: Verhindere Konflikt mit anderen Bots
This commit is contained in:
parent
0383799ed9
commit
a1453c6795
@ -124,9 +124,10 @@ function bot:on_callback_receive(callback, msg, config) -- whenever a new callba
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if not callback.data:find(':') then
|
if not callback.data:find(':') or not callback.data:find(self.info.username) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
callback.data = string.gsub(callback.data, '@'..self.info.username..' ', "")
|
||||||
local called_plugin = callback.data:match('(.*):.*')
|
local called_plugin = callback.data:match('(.*):.*')
|
||||||
local param = callback.data:sub(callback.data:find(':')+1)
|
local param = callback.data:sub(callback.data:find(':')+1)
|
||||||
|
|
||||||
|
@ -94,14 +94,14 @@ function gImages:callback(callback, msg, self, config, input)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if failed then
|
if failed then
|
||||||
utilities.send_reply(self, msg, 'Fehler beim Herunterladen eines Bildes.', true, '{"inline_keyboard":[[{"text":"Nochmal versuchen","callback_data":"gImages:'..input..'"}]]}')
|
utilities.send_reply(self, msg, 'Fehler beim Herunterladen eines Bildes.', true, '{"inline_keyboard":[[{"text":"Nochmal versuchen","callback_data":"@'..self.info.username..' gImages:'..input..'"}]]}')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if mimetype == 'image/gif' then
|
if mimetype == 'image/gif' then
|
||||||
result = utilities.send_document(self, msg.chat.id, file, nil, msg.message_id, '{"inline_keyboard":[[{"text":"Seite aufrufen","url":"'..context..'"},{"text":"Bild aufrufen","url":"'..img_url..'"},{"text":"Nochmal suchen","callback_data":"gImages:'..input..'"}]]}')
|
result = utilities.send_document(self, msg.chat.id, file, nil, msg.message_id, '{"inline_keyboard":[[{"text":"Seite aufrufen","url":"'..context..'"},{"text":"Bild aufrufen","url":"'..img_url..'"},{"text":"Nochmal suchen","callback_data":"@'..self.info.username..' gImages:'..input..'"}]]}')
|
||||||
else
|
else
|
||||||
result = utilities.send_photo(self, msg.chat.id, file, nil, msg.message_id, '{"inline_keyboard":[[{"text":"Seite aufrufen","url":"'..context..'"},{"text":"Bild aufrufen","url":"'..img_url..'"},{"text":"Nochmal suchen","callback_data":"gImages:'..input..'"}]]}')
|
result = utilities.send_photo(self, msg.chat.id, file, nil, msg.message_id, '{"inline_keyboard":[[{"text":"Seite aufrufen","url":"'..context..'"},{"text":"Bild aufrufen","url":"'..img_url..'"},{"text":"Nochmal suchen","callback_data":"@'..self.info.username..' gImages:'..input..'"}]]}')
|
||||||
end
|
end
|
||||||
|
|
||||||
if not result then
|
if not result then
|
||||||
@ -228,9 +228,9 @@ function gImages:action(msg, config, matches)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if mimetype == 'image/gif' then
|
if mimetype == 'image/gif' then
|
||||||
result = utilities.send_document(self, msg.chat.id, file, nil, msg.message_id, '{"inline_keyboard":[[{"text":"Seite aufrufen","url":"'..context..'"},{"text":"Bild aufrufen","url":"'..img_url..'"},{"text":"Nochmal suchen","callback_data":"gImages:'..URL.escape(input)..'"}]]}')
|
result = utilities.send_document(self, msg.chat.id, file, nil, msg.message_id, '{"inline_keyboard":[[{"text":"Seite aufrufen","url":"'..context..'"},{"text":"Bild aufrufen","url":"'..img_url..'"},{"text":"Nochmal suchen","callback_data":"@'..self.info.username..' gImages:'..URL.escape(input)..'"}]]}')
|
||||||
else
|
else
|
||||||
result = utilities.send_photo(self, msg.chat.id, file, nil, msg.message_id, '{"inline_keyboard":[[{"text":"Seite aufrufen","url":"'..context..'"},{"text":"Bild aufrufen","url":"'..img_url..'"},{"text":"Nochmal suchen","callback_data":"gImages:'..URL.escape(input)..'"}]]}')
|
result = utilities.send_photo(self, msg.chat.id, file, nil, msg.message_id, '{"inline_keyboard":[[{"text":"Seite aufrufen","url":"'..context..'"},{"text":"Bild aufrufen","url":"'..img_url..'"},{"text":"Nochmal suchen","callback_data":"@'..self.info.username..' gImages:'..URL.escape(input)..'"}]]}')
|
||||||
end
|
end
|
||||||
|
|
||||||
if not result then
|
if not result then
|
||||||
|
Reference in New Issue
Block a user