CARVIEW |
Select Language
HTTP/2 200
date: Mon, 13 Oct 2025 21:50:53 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=387ea0e06c40a702775231900eb9c448872e42fc5eb13d25632092600a0f29d5a%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22i7RtAL-WdiMNJW6kQSKhSo7PkTcyvpwU%22%3B%7D; HttpOnly; Path=/
cf-ray: 98e20e1deddc5ace-BLR
Notify Action if the context is not canceled within grace period. - Pastebin.com
SHARE
TWEET

Notify Action if the context is not canceled within grace period.
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func yourHandler() {
- // the "recording audio" notification will be sent if we're not able to get the voice generated within 2 seconds.
- cancelNotify := b.sendNotifyAction(ctx, chat, notifyGraceTime)
- voice, cl, genErr := gen.ForUser(ctx, user, text)
- cancelNotify()
- // ...
- }
- // sendNotifyAction sends the "recording" notification if the gracePeriod expires
- // before cancelFn function is called.
- func (b *Bot) sendNotifyAction(ctx context.Context, r tb.Recipient, gracePeriod time.Duration) (cancelFn func()) {
- timeoutCtx, cancel := context.WithTimeout(ctx, 5*time.Minute) // this should never happen, just in case
- go func() {
- region := trace.StartRegion(timeoutCtx, "sendNotifyAction")
- defer region.End()
- select {
- case <-time.After(gracePeriod):
- trace.Logf(ctx, "notify", "sending notify action")
- if err := b.bot.Notify(r, tb.RecordingAudio); err != nil {
- dlog.Printf("%s: notification error: %s", caller(0), err)
- }
- case <-timeoutCtx.Done():
- trace.Logf(timeoutCtx, "notify", timeoutCtx.Err().Error())
- return
- }
- }()
- return cancel
- }
Advertisement
Add Comment
Please, Sign In to add comment
-
💡 Instant BTC Profit Method ✅ Working
JavaScript | 5 sec ago | 0.24 KB
-
⭐✅ Exploit 2500$ in 15 Minutes⭐⭐⭐ H
JavaScript | 6 sec ago | 0.25 KB
-
⭐⭐⭐Instant Profit Method⭐⭐
Java | 7 sec ago | 0.15 KB
-
📝 EASY MONEY GUIDE ✅ Working R
JavaScript | 14 sec ago | 0.25 KB
-
⭐⭐⭐MAKE $1000 INSTANTLY⭐⭐
Java | 22 sec ago | 0.15 KB
-
📌 Instant BTC Profit Method ✅ Working E
JavaScript | 23 sec ago | 0.25 KB
-
📝 MAKE $2500 IN 15 MIN ✅ Working
JavaScript | 24 sec ago | 0.24 KB
-
📝 MAKE $2500 IN 15 MIN ✅ Working
JavaScript | 31 sec ago | 0.24 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand