Skip to content

Commit 3ff8b08

Browse files
committed
some fixs & update readme
1 parent bd74bbd commit 3ff8b08

File tree

5 files changed

+80
-51
lines changed

5 files changed

+80
-51
lines changed

README.md

+50-33
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77

88
Work in progress...
99
文档完善中...
10+
1011
</div>
1112

1213
ManyACG 是针对 Telegram 的 ACG 图片分享频道而设计的 Bot, 兼具爬虫和频道管理功能.
1314

14-
## ⭐特性
15+
## 特性
1516

1617
⚡ 原生跨平台, 轻易部署.
1718

@@ -39,66 +40,82 @@ ManyACG 是针对 Telegram 的 ACG 图片分享频道而设计的 Bot, 兼具爬
3940
编辑配置文件 `config.toml`, 或下载 [配置文件模板](https://github.com/krau/ManyACG/blob/main/config.example.toml) 并重命名为 `config.toml`.
4041

4142
```toml
42-
[api] # Restful API 配置
43-
enable = false
44-
address = "0.0.0.0:39818"
45-
auth = true
46-
token = ""
43+
[api] # RESTful API
44+
enable = false # 是否启用
45+
address = "0.0.0.0:39818" # 监听地址
46+
auth = true # 是否启用认证
47+
token = "123123qwq" # 认证 Token
4748

4849
[fetcher] # 爬虫配置
4950
max_concurrent = 1 # 最大并发数
50-
limit = 30 # 每次从每个源获取的图片数量
51+
limit = 30 # 每次从每个图源最大拉取数量
5152

5253
[log] # 日志配置
53-
level = "TRACE"
54-
file_path = "logs/trace.log"
55-
backup_num = 5
54+
level = "TRACE" # 日志级别
55+
file_path = "logs/trace.log" # 日志文件路径
56+
backup_num = 5 # 日志文件备份数量
5657

5758
[source] # 图源配置
5859
proxy = "" # 向图源发起请求时使用的代理, 支持 http/https/socks5
60+
5961
[source.pixiv]
6062
enable = true
61-
proxy = "i.pixiv.re" # Pixiv 反代域名
63+
proxy = "pixiv.re" # Pixiv 反向代理域名
6264
urls = [] # Pixiv RSS 地址
63-
intervel = 60 # 爬取间隔, 单位: 分钟
64-
sleep = 1 # 请求间隔, 单位: 秒
65+
intervel = 60 # 拉取间隔, 单位: 分钟
66+
sleep = 1 # 拉取间隔内每次请求间隔, 单位: 秒
6567
[[source.pixiv.cookies]] # Pixiv Cookies, 可在浏览器打开 F12 -> Application -> Cookies 中找到
6668
name = "PHPSESSID"
67-
value = "114514_wwwoooqqqqaaa"
69+
value = "123_qwq"
6870
[[source.pixiv.cookies]]
6971
name = "yuid_b"
70-
value = "I1O12N"
72+
value = "1A2B3C"
7173

7274
[source.twitter]
7375
enable = true
7476
fx_twitter_domain = "fxtwitter.com" # FxTwitter 主域名
7577

76-
[storage] # 原图存储配置
77-
type = "webdav" # 存储类型
78+
[source.bilibili]
79+
enable = true
80+
81+
[source.danbooru]
82+
enable = true
83+
84+
[source.kemono]
85+
enable = true
86+
session = "" # Kemono Session Key, 可选
87+
88+
[storage] # 原图存储策略配置
89+
type = "webdav" # 存储类型, 目前仅支持 WebDAV
90+
cache_dir = "./cache" # 缓存文件目录
91+
cache_ttl = 114514 # 缓存过期时间, 单位: 秒
92+
7893
[storage.webdav]
79-
url = "" # WebDAV 服务器地址
80-
username = "" # WebDAV 用户名
81-
password = "" # WebDAV 密码
94+
url = "https://example.com/dav"
95+
username = "dav@example.com"
96+
password = "1231145"
8297
path = "/" # 存储路径
83-
cache_dir = "./cache" # 缓存目录
84-
cache_ttl = 3600 # 缓存过期时间, 单位: 秒
8598

86-
[telegram] # Telegram 配置
87-
token = "" # Bot Token
88-
username = "@manyacg" # 频道用户名, 需要包含 @
89-
sleep = 5 # 发送间隔, 单位: 秒
90-
admins = [] # 管理员 ID
91-
92-
[database] # 数据库配置
99+
[telegram]
100+
token = "token"
101+
api_url = "" # Telegram API 地址, 默认 https://api.telegram.org
102+
username = "@manyacg" # 频道用户名
103+
chat_id = -100114514 # 频道 ID. username 和 chat_id 仅需设置一个, 若频道为公开频道, 请使用 username
104+
sleep = 1 # 向频道中发布作品间隔, 单位: 秒
105+
group_id = -100114514 # 频道附属群组 id, 可选
106+
admins = [114514]
107+
108+
[database]
109+
uri = "mongodb://admin:mongo@127.0.0.1:27017/?authSource=admin" # 当 uri 不为空时, 优先使用 uri 直接连接数据库
93110
host = "127.0.0.1"
94111
port = 27017
95-
user = ""
96-
password = ""
112+
user = "krau"
113+
password = "1919810"
97114
database = "manyacg"
98-
uri = "" # 当 uri 不为空时, 优先使用 uri 直接连接数据库
99115
```
100116

101117
## 更新
118+
102119
### 二进制更新
103120

104-
使用 ManyACG update 可自动下载最新适合当前系统的 Release.
121+
使用 ManyACG update 可自动下载最新适合当前系统的 Release.

cmd/version.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
)
88

99
const (
10-
Version string = "0.10.7"
10+
Version string = "0.10.8"
1111
)
1212

1313
var VersionCmd = &cobra.Command{

config.example.toml

+23-15
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
enable = false
33
address = "0.0.0.0:39818"
44
auth = true
5-
token = ""
5+
token = "123123qwq"
66

77
[fetcher]
88
max_concurrent = 1
@@ -17,16 +17,16 @@ backup_num = 5
1717
proxy = ""
1818
[source.pixiv]
1919
enable = true
20-
proxy = "i.pixiv.re"
20+
proxy = "pixiv.re"
2121
urls = []
2222
intervel = 60
2323
sleep = 1
2424
[[source.pixiv.cookies]]
2525
name = "PHPSESSID"
26-
value = "114514_wwwoooqqqqaaa"
26+
value = "123_qwq"
2727
[[source.pixiv.cookies]]
2828
name = "yuid_b"
29-
value = "I1O12N"
29+
value = "1A2B3C"
3030

3131
[source.twitter]
3232
enable = true
@@ -35,28 +35,36 @@ fx_twitter_domain = "fxtwitter.com"
3535
[source.bilibili]
3636
enable = true
3737

38+
[source.danbooru]
39+
enable = true
40+
41+
[source.kemono]
42+
enable = true
43+
session = ""
44+
3845
[storage]
3946
type = "webdav"
4047
cache_dir = "./cache"
41-
cache_ttl = 20
48+
cache_ttl = 114514
4249

4350
[storage.webdav]
44-
url = ""
45-
username = ""
46-
password = ""
51+
url = "https://example.com/dav"
52+
username = "dav@example.com"
53+
password = "1231145"
4754
path = "/"
4855

49-
5056
[telegram]
51-
token = ""
57+
token = "token"
58+
api_url = ""
5259
username = "@manyacg"
53-
sleep = 5
54-
admins = []
60+
sleep = 1
61+
group_id = -100114514
62+
admins = [114514]
5563

5664
[database]
5765
host = "127.0.0.1"
5866
port = 27017
59-
user = ""
60-
password = ""
67+
user = "krau"
68+
password = "1919810"
6169
database = "manyacg"
62-
uri = ""
70+
uri = "mongodb://admin:mongo@127.0.0.1:27017/?authSource=admin"

telegram/telegram.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,14 @@ var (
101101

102102
func InitBot() {
103103
var err error
104+
apiUrl := config.Cfg.Telegram.APIURL
105+
if apiUrl == "" {
106+
apiUrl = "https://api.telegram.org"
107+
}
104108
Bot, err = telego.NewBot(
105109
config.Cfg.Telegram.Token,
106110
telego.WithDefaultLogger(false, true),
107-
telego.WithAPIServer(config.Cfg.Telegram.APIURL),
111+
telego.WithAPIServer(apiUrl),
108112
)
109113
if err != nil {
110114
Logger.Fatalf("Error when creating bot: %s", err)

telegram/utils.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func ReplyMessageWithHTML(bot *telego.Bot, message telego.Message, text string)
164164
}
165165

166166
func GetArtworkPostMessageURL(messageID int) string {
167-
return fmt.Sprintf("https://t.me/%s/%d", strings.ReplaceAll(ChannelChatID.String(), "@", ""), messageID)
167+
return fmt.Sprintf("https://t.me/%s/%d", strings.TrimPrefix(strings.TrimPrefix(ChannelChatID.String(), "-100"), "@"), messageID)
168168
}
169169

170170
func GetDeepLinkForFile(messageID int) string {

0 commit comments

Comments
 (0)