安装java
- ubuntu:
sudo apt install openjdk-17-jdk
- windows: 前往oracle手动下载安装
申请tg机器人
- 添加 https://t.me/BotFather 为好友
- 如图所示即可创建机器人
- 下载jar文件
- cd到jar文件所在目录,使用
java -jar 文件名.jar
运行 - 初次运行会生成
config.json
配置文件,编辑该json文件并再次运行jar
-
- ubuntu:
sudo apt install openjdk-17-jdk
- windows: 前往oracle手动下载安装
- ubuntu:
-
- ubuntu:
- 安装
sudo apt install maven
- 设置代理
export HTTP_PROXY=http://127.0.0.1:20171 export HTTPS_PROXY=http://127.0.0.1:20171
- 安装
- windows:
-
手动安装: 在官网下载并配置环境变量
-
命令安装:
1. 组合键win+s
搜索powershell
,以管理员身份运行powershell
2. 依次执行
Set-ExecutionPolicy Bypass -Scope Process -Force
iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex
(若提示安装失败,可使用Remove-Item C:\ProgramData\chocolatey -Recurse
删除chocolatey目录,然后再次尝试安装)
choco install maven
3. 将maven
添加进系统环境变量
$currentPath = [Environment]::GetEnvironmentVariable("PATH", "Machine")
$newPathToAdd = "C:\ProgramData\chocolatey\lib\maven\apache-maven-3.9.6\bin"
-
- ubuntu:
-
git clone https://github.com/xmexg/tgsetu.git
cd tgsetu
-
mvn clean package
[INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 14.407 s [INFO] Finished at: 2023-12-17T17:08:57+08:00 [INFO] ------------------------------------------------------------------------
-
windows在cmd中运行
cd target
java -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPost=(你的代理端口) -jar tgst-1.0-SNAPSHOT-jar-with-dependencies.jar
国内不能连接到telegram, 有如下两种方法:- 你尝试添加
-DsocksProxyHost=127.0.0.1 -DsocksProxyPort=(你的http代理端口)
设置socks代理
java -DsocksProxyHost=127.0.0.1 -DsocksProxyPort=10810 -jar tgst-2.0-SNAPSHOT-jar-with-dependencies.jar
- 在国外服务器运行该程序
推荐第二种方法, 因为第一种方法不稳定, 即便设置代理,有时也会意外断开连接
- 你尝试添加
{
"tgBotName": "",
"tgBotToken": "",
"message": [
{
"type": "help",
"keyWord": ["help", "/help", "start", "/start", "帮助", "/帮助"],
"intro": "色图机器人 for telegram, 仓库地址: https://github.com/xmexg/tgsetu"
},
{
"type": "image",
"keyWord": ["/hentai", "hentai", "/setu", "setu", "色图", "涩图", "来点色图", "来点涩图", "来张色图", "来张涩图"],
"url": "https://moe.jitsu.top/r18",
"intro": "R18图"
},
{
"type": "image",
"keyWord": ["/bg", "bg", "二次元"],
"url": "https://www.loliapi.com/bg/",
"intro": "随机二次元图"
},
{
"type": "image",
"keyWord": ["/pc", "pc"],
"url": "https://www.loliapi.com/acg/pc/",
"intro": "二次元电脑图"
},
{
"type": "image",
"keyWord": ["/pe", "pe"],
"url": "https://www.loliapi.com/acg/pe/",
"intro": "二次元手机图"
},
{
"type": "image",
"keyWord": ["/tx", "tx", "头像"],
"url": "https://www.loliapi.com/acg/pp/",
"intro": "二次元头像"
}
]
}