aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaria Lisina <sekoohaka.sarisan@gmail.com>2024-08-19 16:27:28 +0300
committerMaria Lisina <sekoohaka.sarisan@gmail.com>2024-08-19 16:27:28 +0300
commitdd2bcfc9ec5e414efebf25ee7d32fa367ae256b6 (patch)
treea244785fb61fb4e7fbfa2fcb45a949cc0861481b
parente81d007351ec7d40647087492ad39b4da0c3ed56 (diff)
bot.sh: Add parameter alias
Signed-off-by: Maria Lisina <sekoohaka.sarisan@gmail.com>
-rwxr-xr-xbot.sh3
-rw-r--r--modules/commands2
-rw-r--r--submodules/ib_date2
-rw-r--r--submodules/ib_size2
4 files changed, 5 insertions, 4 deletions
diff --git a/bot.sh b/bot.sh
index 376931d..43bf7c3 100755
--- a/bot.sh
+++ b/bot.sh
@@ -137,7 +137,8 @@ do
read -p "Telegram Bot API Token: " -r token
done
-alias enhash="sha1sum | cut -d ' ' -f 1"
+alias parameter="cut -d ' ' -f"
+alias enhash="sha1sum | parameter 1"
alias htmlescape="sed -e 's/</\&#60;/g' -e 's/>/\&#62;/g'"
alias urlencode="jq -Rr @uri"
diff --git a/modules/commands b/modules/commands
index cfed9a8..f90c1ab 100644
--- a/modules/commands
+++ b/modules/commands
@@ -127,7 +127,7 @@ then
if [ "${reply_text}" != "null" ]
then
ib_reply_name="$(printf "%s" "${reply_text}" | sed '1!d')"
- ib_post_id="$(printf "%s" "${reply_text}" | grep 'ID' | cut -d ' ' -f 2)"
+ ib_post_id="$(printf "%s" "${reply_text}" | grep 'ID' | parameter 2)"
for ib_board in ${ascii_table}
do
diff --git a/submodules/ib_date b/submodules/ib_date
index 739c19b..a6011ff 100644
--- a/submodules/ib_date
+++ b/submodules/ib_date
@@ -8,7 +8,7 @@ if [ -n "${ib_created_at}" ] && [ "${ib_created_at}" != "null" ]
then
if [ -n "${ib_itzfield}" ]
then
- ib_created_at="$(printf "%s" "${ib_created_at}" | cut -d ' ' -f ${ib_itzfield})"
+ ib_created_at="$(printf "%s" "${ib_created_at}" | parameter ${ib_itzfield})"
fi
if [ -n "${ib_idate}" ]
diff --git a/submodules/ib_size b/submodules/ib_size
index 4385cc8..452540b 100644
--- a/submodules/ib_size
+++ b/submodules/ib_size
@@ -19,4 +19,4 @@ ib_file_size="$(curl --head \
--proxy "${external_proxy}" \
--silent \
--user-agent "Sekoohaka" \
- "${ib_file_url}" | grep -i "content-length" | cut -d ' ' -f 2)"
+ "${ib_file_url}" | grep -i "content-length" | parameter 2)"