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
#[Main file] | |
import requests | |
class PyTranslate: | |
"Main class" | |
def __init__(self, token: str): | |
":token: token from Translo API (https://rapidapi.com/armangokka/api/translo)" | |
self.token = token | |
self.url = "https://translo.p.rapidapi.com/api/v3/" |
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
// https://go.dev/play/p/0CHrCSOkdbD | |
func replace(s, old, new string, count, skip int) string { | |
var startIdx int | |
for i := 0; i < skip; i++ { | |
idx := strings.Index(s[startIdx:], old) | |
if idx == -1 { | |
return s | |
} |
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
import ( | |
"github.com/go-telegram-bot-api/telegram-bot-api" | |
"unicode/utf16" | |
"golang.org/x/text/unicode/norm" | |
) | |
func indexDelim(text []uint16, limit int, delims string) (offset int) { | |
if len(text) < limit { | |
return len(text) | |
} else if len(text) > limit { |