forked from UsergeTeam/Userge
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
193 additions
and
137 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. | ||
# | ||
# This file is part of < https://github.com/UsergeTeam/Userge > project, | ||
# and is released under the "GNU v3.0 License Agreement". | ||
# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > | ||
# | ||
# All rights reserved. | ||
|
||
. init/logbot/core/utils.sh | ||
|
||
api.getUpdates() { | ||
local params=($*) | ||
_getResponse $FUNCNAME ${params[*]} | ||
} | ||
|
||
api.sendMessage() { | ||
local params=( | ||
chat_id=$1 | ||
text=$(urlEncode "$2") | ||
parse_mode=HTML | ||
) | ||
test -n $3 && params+=(reply_to_message_id=$3) | ||
log "$2" | ||
_getResponse $FUNCNAME ${params[*]} | ||
} | ||
|
||
api.editMessageText() { | ||
local params=( | ||
chat_id=$1 | ||
message_id=$2 | ||
text=$(urlEncode "$3") | ||
parse_mode=HTML | ||
) | ||
log "$3" | ||
_getResponse $FUNCNAME ${params[*]} | ||
} | ||
|
||
api.deleteMessage() { | ||
local params=( | ||
chat_id=$1 | ||
message_id=$2 | ||
) | ||
unset _allMessages[$3] | ||
_getResponse $FUNCNAME ${params[*]} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. | ||
# | ||
# This file is part of < https://github.com/UsergeTeam/Userge > project, | ||
# and is released under the "GNU v3.0 License Agreement". | ||
# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > | ||
# | ||
# All rights reserved. | ||
|
||
. init/logbot/core/types/types.sh | ||
. init/logbot/core/api.sh | ||
. init/logbot/core/rawMethods.sh | ||
. init/logbot/core/apiMethods.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. | ||
# | ||
# This file is part of < https://github.com/UsergeTeam/Userge > project, | ||
# and is released under the "GNU v3.0 License Agreement". | ||
# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > | ||
# | ||
# All rights reserved. | ||
|
||
raw.getMessageCount() { | ||
return ${#_allMessages[@]} | ||
} | ||
|
||
raw.getAllMessages() { | ||
echo ${_allMessages[@]} | ||
} | ||
|
||
raw.getLastMessage() { | ||
if test ${#_allMessages[@]} -gt 0; then | ||
${_allMessages[-1]}.$1 "$2" | ||
elif [[ -n $BOT_TOKEN && -n $LOG_CHANNEL_ID ]]; then | ||
log "first sendMessage ! (caused by \"core.api.$FUNCNAME\")\n"$2"" | ||
else | ||
log "$2" | ||
fi | ||
} |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >. | ||
# | ||
# This file is part of < https://github.com/UsergeTeam/Userge > project, | ||
# and is released under the "GNU v3.0 License Agreement". | ||
# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE > | ||
# | ||
# All rights reserved. | ||
|
||
urlEncode() { | ||
echo "<code>$(echo "${1#\~}" | sed -E 's/(\\t)|(\\n)/ /g' | | ||
curl -Gso /dev/null -w %{url_effective} --data-urlencode @- "" | cut -c 3-)</code>" | ||
} |
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
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
File renamed without changes.
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
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
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
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
Oops, something went wrong.