This commit is contained in:
Bohdan Horbeshko 2022-02-08 15:25:58 -05:00
parent fe7346a530
commit ec49d5d412
7 changed files with 37 additions and 36 deletions

View file

@ -17,6 +17,7 @@ import (
const notEnoughArguments string = "Not enough arguments"
const telegramNotInitialized string = "Telegram connection is not initialized yet"
const notOnline string = "Not online"
var permissionsAdmin = client.ChatMemberStatusAdministrator{
CanBeEdited: true,
CanChangeInfo: true,
@ -144,13 +145,13 @@ func parseCommand(cmdline string) (string, []string) {
return bodyFields[0][1:], bodyFields[1:]
}
func rawCmdArguments(cmdline string, start uint8) (string) {
func rawCmdArguments(cmdline string, start uint8) string {
var state uint
// /cmd ababa galamaga
// 01 2 3 45
startState := uint(3 + 2 * start)
startState := uint(3 + 2*start)
for i, r := range cmdline {
isOdd := state % 2 == 1
isOdd := state%2 == 1
isSpace := unicode.IsSpace(r)
if (!isOdd && !isSpace) || (isOdd && isSpace) {
state += 1

View file

@ -212,7 +212,7 @@ func (c *Client) ProcessStatusUpdate(chatID int64, status string, show string, o
c.cache.SetStatus(chatID, show, status)
newArgs := []args.V {
newArgs := []args.V{
gateway.SPFrom(strconv.FormatInt(chatID, 10)),
gateway.SPShow(show),
gateway.SPStatus(status),
@ -331,7 +331,7 @@ func (c *Client) formatForward(fwd *client.MessageForwardInfo) string {
if originChat.AuthorSignature != "" {
signature = fmt.Sprintf(" (%s)", originChat.AuthorSignature)
}
return c.formatContact(originChat.SenderChatId)+signature
return c.formatContact(originChat.SenderChatId) + signature
case client.TypeMessageForwardOriginHiddenUser:
originUser := fwd.Origin.(*client.MessageForwardOriginHiddenUser)
return originUser.SenderName
@ -341,7 +341,7 @@ func (c *Client) formatForward(fwd *client.MessageForwardInfo) string {
if channel.AuthorSignature != "" {
signature = fmt.Sprintf(" (%s)", channel.AuthorSignature)
}
return c.formatContact(channel.ChatId)+signature
return c.formatContact(channel.ChatId) + signature
case client.TypeMessageForwardOriginMessageImport:
originImport := fwd.Origin.(*client.MessageForwardOriginMessageImport)
return originImport.SenderName