Add bernie meme

This commit is contained in:
Sangeeth Sudheer 2025-04-01 17:50:51 +05:30
parent 6258f1537b
commit 380b9bb7dd
Signed by: x
GPG Key ID: F6D06ECE734C57D1
3 changed files with 34 additions and 8 deletions

BIN
bernie.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

View File

@ -4,3 +4,6 @@ import _ "embed"
//go:embed message.md //go:embed message.md
var AutoResponderMessage string var AutoResponderMessage string
//go:embed bernie.jpg
var Bernie []byte

View File

@ -131,7 +131,7 @@ func (client *Client) hasAutoRespondedWithinSameDay(userId string) bool {
func (client *Client) updateAutoResponseTime(userId string) { func (client *Client) updateAutoResponseTime(userId string) {
client.autoResponseTimeMap[userId] = time.Now().Format(time.RFC3339) client.autoResponseTimeMap[userId] = time.Now().Format(time.RFC3339)
bytes, err := json.Marshal(client.autoResponseTimeMap) bytes, err := json.MarshalIndent(client.autoResponseTimeMap, "", " ")
if err != nil { if err != nil {
panic(err) panic(err)
@ -173,13 +173,36 @@ func (client *Client) eventHandler(evt interface{}) {
time.Sleep(2 * time.Duration(rand.IntN(3)) * time.Second) time.Sleep(2 * time.Duration(rand.IntN(3)) * time.Second)
client.WAClient.SendMessage( msg := proto.String(client.message + "\n\nIgnore this random number: `" + strconv.FormatInt(time.Now().UnixMilli(), 10) + "`")
context.Background(),
v.Info.Chat, imageResp, err := client.WAClient.Upload(context.Background(), waautoresponder.Bernie, whatsmeow.MediaImage)
&waE2E.Message{
Conversation: proto.String(client.message + "\n\nIgnore this random number: `" + strconv.FormatInt(time.Now().UnixMilli(), 10) + "`"), if err == nil {
}, client.WAClient.SendMessage(
) context.Background(),
v.Info.Chat,
&waE2E.Message{
ImageMessage: &waE2E.ImageMessage{
Caption: msg,
Mimetype: proto.String("image/jpeg"),
URL: &imageResp.URL,
DirectPath: &imageResp.DirectPath,
MediaKey: imageResp.MediaKey,
FileEncSHA256: imageResp.FileEncSHA256,
FileSHA256: imageResp.FileSHA256,
FileLength: &imageResp.FileLength,
},
})
} else {
client.WAClient.SendMessage(
context.Background(),
v.Info.Chat,
&waE2E.Message{
Conversation: msg,
},
)
}
client.WAClient.SendChatPresence(v.Info.Chat, types.ChatPresencePaused, types.ChatPresenceMediaText) client.WAClient.SendChatPresence(v.Info.Chat, types.ChatPresencePaused, types.ChatPresenceMediaText)