-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5cdb3e9
commit 0690cf9
Showing
13 changed files
with
843 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,27 @@ | ||
package command | ||
|
||
import ( | ||
log "github.com/sirupsen/logrus" | ||
"gopkg.in/tucnak/telebot.v2" | ||
"gopkg.in/telebot.v3" | ||
"strconv" | ||
"time" | ||
|
||
log "github.com/sirupsen/logrus" | ||
) | ||
|
||
// Image 返回随机必应图片 | ||
func Image(bot *telebot.Bot) { | ||
bot.Handle("/image", func(m *telebot.Message) { | ||
bot.Handle("/image", func(ctx telebot.Context) error { | ||
// 暂时先只做 Bing | ||
photo := &telebot.Photo{ | ||
File: telebot.FromURL("https://uploadbeta.com/api/pictures/random/?key=BingEverydayWallpaperPicture&r=" + strconv.FormatInt(time.Now().UnixNano(), 10)), | ||
} | ||
_, err := photo.Send(bot, m.Chat, &telebot.SendOptions{ | ||
ReplyTo: m, | ||
_, err := photo.Send(bot, ctx.Chat(), &telebot.SendOptions{ | ||
ReplyTo: ctx.Message(), | ||
}) | ||
if err != nil { | ||
log.Errorf("发送消息时发生了错误,错误信息: %s \n", err) | ||
return err | ||
} | ||
return nil | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,47 @@ | ||
module github.com/hitokoto-osc/telegram_bot | ||
|
||
go 1.14 | ||
go 1.21 | ||
|
||
require ( | ||
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect | ||
github.com/go-ole/go-ole v1.2.4 // indirect | ||
github.com/levigross/grequests v0.0.0-20190908174114-253788527a1a | ||
github.com/levigross/grequests v0.0.0-20221222020224-9eee758d18d5 | ||
github.com/shirou/gopsutil/v3 v3.23.8 | ||
github.com/sirupsen/logrus v1.9.3 | ||
github.com/spf13/viper v1.16.0 | ||
gopkg.in/telebot.v3 v3.1.3 | ||
) | ||
|
||
require ( | ||
github.com/BurntSushi/toml v1.3.2 // indirect | ||
github.com/chavacava/garif v0.1.0 // indirect | ||
github.com/fatih/color v1.15.0 // indirect | ||
github.com/fatih/structtag v1.2.0 // indirect | ||
github.com/fsnotify/fsnotify v1.6.0 // indirect | ||
github.com/go-ole/go-ole v1.3.0 // indirect | ||
github.com/google/go-querystring v1.1.0 // indirect | ||
github.com/hashicorp/hcl v1.0.0 // indirect | ||
github.com/magiconair/properties v1.8.7 // indirect | ||
github.com/mattn/go-colorable v0.1.13 // indirect | ||
github.com/mattn/go-isatty v0.0.19 // indirect | ||
github.com/mattn/go-runewidth v0.0.15 // indirect | ||
github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517 // indirect | ||
github.com/mgechev/revive v1.3.3 // indirect | ||
github.com/mitchellh/go-homedir v1.1.0 // indirect | ||
github.com/mitchellh/mapstructure v1.5.0 // indirect | ||
github.com/olekukonko/tablewriter v0.0.5 // indirect | ||
github.com/pelletier/go-toml/v2 v2.1.0 // indirect | ||
github.com/pkg/errors v0.9.1 // indirect | ||
github.com/shirou/gopsutil v3.21.1+incompatible | ||
github.com/sirupsen/logrus v1.7.0 | ||
github.com/spf13/viper v1.7.1 | ||
github.com/stretchr/testify v1.6.1 // indirect | ||
golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect | ||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c // indirect | ||
gopkg.in/tucnak/telebot.v2 v2.3.5 | ||
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect | ||
github.com/rivo/uniseg v0.4.4 // indirect | ||
github.com/spf13/afero v1.9.5 // indirect | ||
github.com/spf13/cast v1.5.1 // indirect | ||
github.com/spf13/jwalterweatherman v1.1.0 // indirect | ||
github.com/spf13/pflag v1.0.5 // indirect | ||
github.com/subosito/gotenv v1.6.0 // indirect | ||
github.com/yusufpapurcu/wmi v1.2.3 // indirect | ||
golang.org/x/net v0.15.0 // indirect | ||
golang.org/x/sys v0.12.0 // indirect | ||
golang.org/x/text v0.13.0 // indirect | ||
golang.org/x/tools v0.13.0 // indirect | ||
gopkg.in/ini.v1 v1.67.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
) |
Oops, something went wrong.