Community discussions

MikroTik App
 
MarkReyan
just joined
Topic Author
Posts: 14
Joined: Wed Dec 28, 2022 9:40 am
Location: UK

Send Traceroute Report to the Telegram

Mon Mar 20, 2023 11:52 am

Hello
I'm trying to send a traceroute Report to the Telegram here is the script:

:local chat_id
:local bot_token
:local destination "8.8.8.8" # or any other IP address or domain name

:local output [/tool traceroute $destination]

:local timestamp [/system clock get value-name=time]

:local message "Traceroute to $destination (run at $timestamp):\n\n$output"

/tool fetch url=("https://api.telegram.org/bot$bot_token/ ... t=$message") mode=https

The script working correctly but the problem is here [/tool fetch url=("https://api.telegram.org/bot$bot_token/ ... t=$message") mode=https] I can't send the result ($message) which means Telegram URL doesn't accept variable , but when I change to static text it's work
also I tried to encode the output like that :
:local message [/urlencode $output]
instead of using
:local message "Traceroute to $destination (run at $timestamp):\n\n$output"
the same problem
Thanks
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Send Traceroute Report to the Telegram

Mon Mar 20, 2023 12:27 pm

If you use "url", "mode" is useless.
<<paste ASCIItoCP1252toURLencode function here>>

:local chat_id     ""
:local bot_token   ""
:local destination "8.8.8.8"

:local output    [/tool traceroute $destination]
:local timestamp [/system clock get time]
:local message   [$ASCIItoCP1252toURLencode ("Traceroute to $destination (run at $timestamp):\r\n\r\n$output")]

/tool fetch url="https://api.telegram.org/bot$bot_token/sendMessage\3Fchat_id=$chat_id&text=$message"

You must "escape" the variable for be used on GET parameter.
viewtopic.php?t=177551#p980163
 
MarkReyan
just joined
Topic Author
Posts: 14
Joined: Wed Dec 28, 2022 9:40 am
Location: UK

Re: Send Traceroute Report to the Telegram

Mon Mar 20, 2023 12:42 pm

Can you give me an example how it should be
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Send Traceroute Report to the Telegram

Mon Mar 20, 2023 12:52 pm

Can you give me an example how it should be
...and didn't I just do it?

How many time you need the same info?
viewtopic.php?p=974517#p974797
Bad attitude copy&paste without understand what you doing...

Not noticed before:
:local message [/urlencode $output] 
Where you find this shit, from ChatGPT?
 
MarkReyan
just joined
Topic Author
Posts: 14
Joined: Wed Dec 28, 2022 9:40 am
Location: UK

Re: Send Traceroute Report to the Telegram

Mon Mar 20, 2023 1:10 pm

Yeah this shit from ChatGPT

ASCIItoCP1252toURLencode should be like that :
:global ASCIItoCP1252toURLencode do={
:local ascii "\00\01\02\03\04\05\06\07\08\09\0A\0B\0C\0D\0E\0F\
\10\11\12\13\14\15\16\17\18\19\1A\1B\1C\1D\1E\1F\
\20\21\22\23\24\25\26\27\28\29\2A\2B\2C\2D\2E\2F\
\30\31\32\33\34\35\36\37\38\39\3A\3B\3C\3D\3E\3F\
\40\41\42\43\44\45\46\47\48\49\4A\4B\4C\4D\4E\4F\
\50\51\52\53\54\55\56\57\58\59\5A\5B\5C\5D\5E\5F\
\60\61\62\63\64\65\66\67\68\69\6A\6B\6C\6D\6E\6F\
\70\71\72\73\74\75\76\77\78\79\7A\7B\7C\7D\7E\7F\
\80\81\82\83\84\85\86\87\88\89\8A\8B\8C\8D\8E\8F\
\90\91\92\93\94\95\96\97\98\99\9A\9B\9C\9D\9E\9F\
\A0\A1\A2\A3\A4\A5\A6\A7\A8\A9\AA\AB\AC\AD\AE\AF\
\B0\B1\B2\B3\B4\B5\B6\B7\B8\B9\BA\BB\BC\BD\BE\BF\
\C0\C1\C2\C3\C4\C5\C6\C7\C8\C9\CA\CB\CC\CD\CE\CF\
\D0\D1\D2\D3\D4\D5\D6\D7\D8\D9\DA\DB\DC\DD\DE\DF\
\E0\E1\E2\E3\E4\E5\E6\E7\E8\E9\EA\EB\EC\ED\EE\EF\
\F0\F1\F2\F3\F4\F5\F6\F7\F8\F9\FA\FB\FC\FD\FE\FF"
}
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Send Traceroute Report to the Telegram

Mon Mar 20, 2023 1:16 pm

I don't provide any help from what it comes from that shit.

But you can not do a complete copy & paste? Why only a few lines? Are the others there for nothing?

End of help.
 
MarkReyan
just joined
Topic Author
Posts: 14
Joined: Wed Dec 28, 2022 9:40 am
Location: UK

Re: Send Traceroute Report to the Telegram

Mon Mar 20, 2023 1:26 pm

Yeah better to not provide any help if you reply like that
it's not related to copy & paste man this part of my script it didn't work anyway that's why I Asked
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Send Traceroute Report to the Telegram

Mon Mar 20, 2023 1:39 pm

Yeah better to not provide any help if you reply like that
it's not related to copy & paste man this part of my script it didn't work anyway that's why I Asked
As I have already written to you, I have already answered you, and correctly.
Just copy and paste the full function, which you can find in the link, in place of the placeholder and it should work.


As for the rest, ask ChatGPT where you can get help on ChatGPT falsehoods.
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3255
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: Send Traceroute Report to the Telegram

Mon Mar 20, 2023 2:16 pm

Did that script really come from chatgpt, or are you kidding?

@rextended's concern is there have been a lot of posting with bad code that originated from ChatGPT.

The code that needs to be inserted can be found here:
viewtopic.php?t=177551#p980163
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Send Traceroute Report to the Telegram

Mon Mar 20, 2023 2:22 pm

The code that needs to be inserted can be found here:
viewtopic.php?t=177551#p980163
Already provided on post #2, and on the post #5 is clear that have read the post...


Is true:
:local message [/urlencode $output]
"/urlencode" not exist, another ChatGPT lie
 
User avatar
anav
Forum Guru
Forum Guru
Posts: 19107
Joined: Sun Feb 18, 2018 11:28 pm
Location: Nova Scotia, Canada
Contact:

Re: Send Traceroute Report to the Telegram

Mon Mar 20, 2023 2:39 pm

rextended, first rule of discipline is that when you say end of help, it really means end of help ;-)
Dont write any childrens books..........
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Send Traceroute Report to the Telegram

Mon Mar 20, 2023 2:45 pm

Dont write any childrens books..........
Now, I've already written post number #2, it was just a clarification,
and to highlight that when someone use one (supposed) Artificial Intelligence, that person admit that don't have one for himself.
 
MarkReyan
just joined
Topic Author
Posts: 14
Joined: Wed Dec 28, 2022 9:40 am
Location: UK

Re: Send Traceroute Report to the Telegram

Mon Mar 20, 2023 3:04 pm

by the way this AI is just a help tool ,so that's mean you can just try without depending on it
simply you can reply by advice or somethıng useful instead of replying with meaningless talk
we wrote a lot of useless responses Instead of writing something useful to benefit everyone!!
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Send Traceroute Report to the Telegram

Mon Mar 20, 2023 3:22 pm

simply you can reply by advice or somethıng useful instead of replying with meaningless talk
we wrote a lot of useless responses Instead of writing something useful to benefit everyone!!
I have already provided a working solution to do that on post #2,
al other posts, actual or future, are useless, what are you talking about?
Unless you have a different problem than explained at the beginning.

this AI is just a help tool
No, how it is now is just shit. because it's programmed to provide an answer, without any regard if it's true or false.


---------------

"Upside Down" reply:

I have to apologize, my behavior is unjustifiable.
I'm sorry that the hatred I pour towards that shit has clouded my judgment, which therefore has conditioned the tone of the answers.
It wasn't meant to be an offense directed at you.
Sorry again, but it doesn't change that I already answered you in post #2 and that ChatGPT, as it is now, is just a shit, just a little toy.
 
MarkReyan
just joined
Topic Author
Posts: 14
Joined: Wed Dec 28, 2022 9:40 am
Location: UK

Re: Send Traceroute Report to the Telegram

Mon Mar 20, 2023 3:33 pm

No problem bro
I just wanted everything to be clear and benefit for everyone
thank you also for the answer
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11982
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Send Traceroute Report to the Telegram

Mon Mar 20, 2023 3:34 pm

No problem bro
thanks for understanding

Who is online

Users browsing this forum: FurfangosFrigyes and 22 guests