Answer the question
In order to leave comments, you need to log in
How to host multiple telegram bots on a server?
There is a server with ISPManager installed, it has php in conjunction with nginx and mysql
. There are two telegram bots written in java.
How to bind domains or subdomains to bots and so that it does not conflict with the manager?
Answer the question
In order to leave comments, you need to log in
Smoke towards the cuts.
a:='abcdefghijk'[0:4]
b:='abcdefghijk'[4:8]
Run on play.golang
package main
import (
"fmt"
)
func min(a, b int) int {
if a < b {
return a
}
return b
}
func splitIntoChunks(s string, chunkLength int) []string {
length := len(s)
chunksCount := length / chunkLength
if length%chunkLength != 0 {
chunksCount += 1
}
chunks := make([]string, chunksCount)
for i := range chunks {
from := i * chunkLength
to := min(length, from+chunkLength)
chunks[i] = s[from:to]
}
return chunks
}
func main() {
s := "aaabbbcccdddeeee"
fmt.Println(splitIntoChunks(s, 3))
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question