LanHao 发布的文章

 

【由于telegram官方禁止了两个机器人之间相互接收消息,此方法失效!】不过还是可以单方面互联的

比如说telegram+IRC  或是 IRC+qq之类的

 

 

(用于QQ单方面监听微信消息,本次是为了监控我们班家长微信群,特别想的)

| 耗时:三个星期六,很正常的耗时 |

基本想法:

QQ通过IRCshell插件开一个IRC服务器,然后IRC和telegram互联,telegram和wechat用ehforwarderbot连接。IRC和TELEGRAM通过引用的第一个项目进行消息阻断。

涉及到的语言:python, Rust, perl

过程暂仅支持文字传输,QQ群连接telegram1号群进行微信消息的接收

QQ群聊天内容将转移telegram2号群进行消息阻断不会发到微信群


引用github项目:

  1. https://github.com/belst/telegram-irc-bridge  :超重要,单方面监控的TELEGRAM - IRC项目
  2. https://github.com/sjdy521/Mojo-Webqq :QQ-irc 项目,自带的IRCShell很有用,要安装和上面同作者的中文IRC项目
  3. https://github.com/sjdy521/Mojo-IRC-Server-Chinese :配置文件在/usr/local/share/perl/5.18.2/Mojo/IRC,可修改IRC服务器的参数
  4. https://github.com/blueset/ehForwarderBot:wechat ( 微信 ) - telegram
  5. https://github.com/pyenv/pyenv :python 升级

 


我参考了这些教程:

http://doc.crates.io/guide.html:为了运行第一个单方面监控项目参考的教程

http://rustbyexample.com/hello.html:为了运行第一个单方面监控项目参考的教程

https://blog.1a23.com/2017/01/09/EFB-How-to-Send-and-Receive-Messages-from-WeChat-on-Telegram-zh-CN/:这个过时了,不过…

我写了篇新的教程,算是自己摸索出来的吧:http://blog.lanhaoo.club/2017/05/19/%E5%BE%AE%E4%BF%A1-telegram-%E4%BA%92%E8%81%94%EF%BC%88%E4%B8%AD%E6%96%87%EF%BC%89/

python 升级参考(虽然不需要,但是我还是把3.4升级3.5了,那个过时教程叫我3.5,后来看评论才知道github上更新了,3.4也可以):忘记链接了。


懒得写教程了,项目都集齐了。

PS. 最上面的图片来自:https://www.flickr.com/photos/yangsheng/9091888662,该图已申明可再利用和修改,但不能用作商业用途。在这里再利用一次

\   Lyrics is Not Full Version, But For My Life, It is.   \

[ - ]

In the dark
在黑暗中
in the right of the middle mark
在这黯淡之中
·

Just in the tear of everything we rise below the surface
——

In the watch from the distant 17
看着渐远的17岁

Surely others dreams have been gold and undone
青春的梦想再也无法挽回
·

It's not what you painted in my head
这不是你曾向我描绘的未来啊

So much there is yet involved the colors that I saw
这里依旧有许多我尚未看到的色彩
·

We are all living in a dream
沉醉在美好梦境之中

And life ain't what it seems
但真实的生活却不似梦境中那般美好

Where everything's a mess
到处都是一团糟

And all these sorrows I have seen
【 触目之及 / 尽是悲伤 】

They lead me to believe
这使我不得不相信

That everything's a mess
尘世多苦
·

I want to dream
但我依旧有梦

I want to dream
我,依旧有梦

Leave me to dream
让我去追寻我的梦想
·

In the eyes
回想起年少时
of a teenage crystallized
眼中闪烁的光芒

Are the prettiest of lights
有着无法言说的美

That hang the hallways of the home
照亮了家中走廊的每个角落
·

And the cries from the strangers I ignite
被我惊扰的陌生人大声哭喊

They don't keep us up all night
他们不会让我们一整晚诉说自己的苦衷

we have the curtains drawn and closed
我们关上窗户,把窗帘拉下来
·

We are all living in a dream
我们都活在梦境之中

And life ain't what it seems
生活并不像你想象的那般美好

Where everything's a mess
一切都糟糕透了

And all these sorrows I have seen
【 所见之处 / 只剩荒芜 】

They lead me to believe
这让我不得不相信

That everything's a mess
尘世多难
·

I want to dream
但,我还有梦

I want to dream
我,还有梦

Leave me to dream
让我去寻找那美妙梦境
·

I know all your reasons
我听够你的理由了

To keep me from seeing
都是为了隐藏不想被我所见的事实

Everything is actually a mess
一切都是一团糟

But now I, I'm leaving
但是现在,我,我要离开

All of this we're only dreaming
我们只是一场梦而已

Everything is actually a mess
到处都糟透了啊

·

We are all living in a dream
我们都被囚禁在梦中

And life ain't what it seems
生活并不如你所想象的那般

Where everything's a mess
一切的一切,都杂乱不堪

And all these sorrows I have seen
【 无法凝望 / 悲伤遍地 】

They lead me to believe
这都促使我去相信

That everything's a mess
生活不是那么美好
·

BUT I HAVE DREAM

 End of May - Michael Bublé
Golden haze,
金色的薄雾
Another morning feels like yesterday.
又一个清晨,又如昨日
End of may..
五月末
Now you're gone and there's still bills to pay.
账单依旧,而你早已离开
And you know it doesn't help to make believe, you're sitting next to me.
我想象着你在我身旁,在身后安慰我:“一切都还好”
It doesn't help, to make believe that you are right behind me
Saying it's okay.
但我知道 ,这一切都并不真实
Longer days,
白昼变得更加漫长
More time to sit and watch the pendulum sway.
在枯坐中凝望钟摆打发时光
In quiet rage I'm staring at this empty notebook page.
盯着空白的信纸黯然神伤
In times like these you feel like you are done with feeling,
只有在此时,才感受到情感的麻木
You feel you want to stop the pain from healing
想停下那疗伤中的痛苦,
Because you feel like you're the only one,
这时感觉到,这种痛苦
Who's ever felt this way.
唯有我自己才能真正品尝。
Some days in a daze, there's brighter days.
有时候昏昏噩噩, 有时候稍觉快乐
Funny how the feeling never stays,
奇怪的是,人的情绪并无定所
But I know I'll have to come to terms when I'm awake,
清醒之余我知道我依旧要面对现实,
Thinking about you is the icing on the cake.
思念你 只是让我的意识
Makes me realize the fact you're gone for good for goodness sake.
更加 停留在你永远离开我的事实
Golden haze, another morning feels like yesterday.
金色的薄雾,又一个清晨,又如昨日,
End of may, a year is gone and I still feel this way,
五月末,一年过后,我仍为情所困。
When we meet again, I'll ask you how you're doing
如果重逢,我会问你过得怎样
And you'll say fine and ask me how I'm doing
你会说还不错,而且会问我过得好不好
And then I'll lie and I'll say ordinary, It's just an ordinary day.
我会谎称跟往常一样,无甚特殊。
It's just an ordinary day
无甚特殊…
It's just an ordinary day
 无甚特殊。
[embed]https://www.youtube.com/watch?v=0Or9CP4MZts[/embed]

近日成功将wechat(微信)和telegram 互联,使用ehForwarderBot, 此安装教程参考1A23 LABS,但是那个已经过时了,这个是新的

1.开始之前,请准备:

  • 电脑 一台(装有 PuTTY ,WinSCP)
  • 一个微信账号
  • 一个Telegram 账号
  • 墙外 VPS 一枚

2.环境构建

本文使用:Python 3.5.3。(可以使用3.4,可以使用pyenv快速安装3.5版本)

#请不要把下列命令直接复制粘贴……
pyenv install --list #此命令列出所有版本
pyenv install 3.5.3 #此命令安装3.5.3

通过以下命令迅速搭建环境:(ubuntu 14.04之类的可能会提示ffmpeg有错,先不管)

apt-get install python3.5 libopus0 ffmpeg libmagic1 python3-pip git nano

3.创建telegram bot(英文要好)

(BotFather说的都是英文)

@BotFather 发起会话。发送指令 /newbot

指定这个 Bot 的名称与用户名,然后就会有个token(复制保存,以后用)

然后

  1. 发送 /setprivacy 选择Bot 用户名,然后选择 “Disable”.
  2. 发送 /setjoingroups 选择Bot 用户名,然后选择 “Enable”.
  3. 发送 /setcommands 到 @BotFather,选择刚刚创建好的 Bot 用户名,然后发送如下内容(中英两个版本~)
help - Show commands list.
link - Link a remote chat to a group.
unlink_all - Unlink all remote chats from a group.
info - Display information of the current Telegram chat.
chat - Generate a chat head.
recog - Recognize a speech by replying to it. 
extra - Access extra functionalities.
help - 展示全部命令.
link - 连接群组进行跨群聊天.
unlink_all - 取消所有群组的连接.
info - 显示当前telegram信息.
chat - 创建会话头.
recog - 回复语音消息以进行识别. 
extra - 展示额外功能.

然后还需要获取你自己的 Telegram ID,它应显示为一串数字,此ID将作为机器人的管理员。向@userinfobot 发送任意文字即可查询ID(如果失效请在评论中回复)

4.开始制作机器人服务器!

( itchat那句很重要,更新itchat,不然上不去微信 )

输入以下命令

git clone https://github.com/blueset/ehForwarderBot.git
cd ehForwarderBot
pip3 install -r requirements.txt
pip3 install itchat -U
mkdir storage
chmod 777 storage
cp config.sample.py config.py
然后用winscp打开ehForwarderBot 目录下的config.py进行编辑
拉到最下面 token填入机器人的token,admins填入你的telegram ID

5.启动机器人!!

这时你应该还在ehForwarderBot目录

apt-get install screen
screen
python3 daemon.py start

手机打开微信扫描二维码(乱码请将putty界面全屏,或者直接复制下面输出的链接到浏览器登录)

然后就可以接收微信消息了,随意link一个微信群到telegram群,消息就会通过机器人互联

支持的消息内容:

  • 微信→Telegram:文字、图片、视频、分享链接、表情、文档、位置、名片、好友请求、系统通知
  • Telegram→微信:文字、图片、表情(以图片发送)、视频

注意:如果报错,说ffmpeg在82行有错之类的,在出错的那个文件将false改成true就可以了。我不记得当初的那个文件是哪个了

阅读剩余部分