Print message zeigt nun auch "Antwort auf" an
This commit is contained in:
parent
73d48b3c75
commit
d7d1f0cbe0
20
miku/bot.lua
20
miku/bot.lua
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
local bot = {}
|
local bot = {}
|
||||||
|
|
||||||
bot.version = '160824'
|
bot.version = '160906'
|
||||||
|
|
||||||
function bot:init(config) -- The function run when the bot is started or reloaded.
|
function bot:init(config) -- The function run when the bot is started or reloaded.
|
||||||
assert(config.bot_api_key, 'Dein Bot-Token ist nicht in der Config gesetzt!')
|
assert(config.bot_api_key, 'Dein Bot-Token ist nicht in der Config gesetzt!')
|
||||||
@ -106,6 +106,22 @@ function bot:on_msg_receive(msg, config) -- The fn run whenever a message is rec
|
|||||||
full_fwd_name = ''
|
full_fwd_name = ''
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if msg.reply_to_message then
|
||||||
|
if msg.reply_to_message.from.first_name then
|
||||||
|
from_name1 = msg.reply_to_message.from.first_name
|
||||||
|
else
|
||||||
|
from_name1 = ''
|
||||||
|
end
|
||||||
|
if msg.reply_to_message.from.last_name then
|
||||||
|
from_name2 = ' '..msg.reply_to_message.from.last_name
|
||||||
|
else
|
||||||
|
from_name2 = ''
|
||||||
|
end
|
||||||
|
full_from_name = '\27[3mAntwort auf \27[31m'..from_name1..from_name2..'\27[0m: '
|
||||||
|
else
|
||||||
|
full_from_name = ''
|
||||||
|
end
|
||||||
|
|
||||||
if msg.text then
|
if msg.text then
|
||||||
user_msg = msg.text..'\27[0m'
|
user_msg = msg.text..'\27[0m'
|
||||||
elseif msg.caption then
|
elseif msg.caption then
|
||||||
@ -136,7 +152,7 @@ function bot:on_msg_receive(msg, config) -- The fn run whenever a message is rec
|
|||||||
filetext = ''
|
filetext = ''
|
||||||
end
|
end
|
||||||
|
|
||||||
full_message = msg_time..from_chat..full_name..' \27[36m>>>\27[0m '..full_fwd_name..filetext..user_msg
|
full_message = msg_time..from_chat..full_name..' \27[36m>>>\27[0m '..full_fwd_name..full_from_name..filetext..user_msg
|
||||||
print(full_message)
|
print(full_message)
|
||||||
|
|
||||||
if msg.date < os.time() - 5 then return end -- Do not process old messages.
|
if msg.date < os.time() - 5 then return end -- Do not process old messages.
|
||||||
|
Reference in New Issue
Block a user