Feat(Initial): Initial Go codebase
All checks were successful
Webhook-Everything/Webhook-Everything/pipeline/head This commit looks good
All checks were successful
Webhook-Everything/Webhook-Everything/pipeline/head This commit looks good
This commit is contained in:
26
backend/internal/webhookeverything/routegencontrollerweb.go
Normal file
26
backend/internal/webhookeverything/routegencontrollerweb.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package webhookeverything
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
)
|
||||
|
||||
func (env *Env) forwardHookToTelegram(r *http.Request, routeID string) error {
|
||||
// Get Telegram code
|
||||
var routeResult WebhookRoute
|
||||
err := env.DB.Where(&WebhookRoute{WebhookID: routeID}).First(&routeResult).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Dump request as string
|
||||
responseStr, err := httputil.DumpRequest(r, true)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Send telegram
|
||||
env.TelegramEnv.TelegramSend(routeResult.TelegramShortCode, string(responseStr))
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user