mirror of
https://github.com/octoleo/telegram-bot-bash.git
synced 2024-12-28 12:50:44 +00:00
process help at beginning
This commit is contained in:
parent
11b5aab9b9
commit
f1d71a0771
33
.github/ISSUE_TEMPLATE/bug_report.md
vendored
33
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -1,33 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Enter text / Run command '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Bashbot (please complete the following information):**
|
||||
- Version [ grep 'VERSION' bashbot.sh ]
|
||||
- OS: [ uname -a]
|
||||
- Shell [ bash --version]
|
||||
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@ -1,20 +0,0 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
17
.github/ISSUE_TEMPLATE/others.md
vendored
17
.github/ISSUE_TEMPLATE/others.md
vendored
@ -1,17 +0,0 @@
|
||||
---
|
||||
name: Others
|
||||
about: Anything else not a Bug or Feature
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your issue is related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe your idea or complaint**
|
||||
A clear and concise description of what you want to talk about.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about your idea or complaint here.
|
27
bashbot.sh
27
bashbot.sh
@ -11,7 +11,7 @@
|
||||
# This file is public domain in the USA and all free countries.
|
||||
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
|
||||
#
|
||||
#### $$VERSION$$ v0.98-dev-52-g75024a1
|
||||
#### $$VERSION$$ v0.98-dev-53-g11b5aab
|
||||
#
|
||||
# Exit Codes:
|
||||
# - 0 sucess (hopefully)
|
||||
@ -64,6 +64,17 @@ getConfigKey() {
|
||||
[ -r "${BOTCONFIG}.jssh" ] && sed -n 's/\["'"$1"'"\]\t*"\(.*\)"/\1/p' <"${BOTCONFIG}.jssh" | tail -n 1
|
||||
}
|
||||
|
||||
if [ "$1" = "help" ]; then
|
||||
HELP="README"
|
||||
if [ -n "${CLEAR}" ];then
|
||||
_exists w3m && w3m "$HELP.html" && exit
|
||||
_exists lynx && lynx "$HELP.html" && exit
|
||||
_exists less && less "$HELP.txt" && exit
|
||||
fi
|
||||
cat "$HELP.txt"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
# get location and name of bashbot.sh
|
||||
SCRIPT="$0"
|
||||
@ -120,7 +131,7 @@ ERRORLOG="${LOGDIR}/ERROR.log"
|
||||
UPDATELOG="${LOGDIR}/BASHBOT.log"
|
||||
|
||||
# we assume everthing is already set up correctly if we have TOKEN
|
||||
if [[ -z "${BOTTOKEN}" && "${1}" != "help" ]]; then
|
||||
if [ -z "${BOTTOKEN}" ]; then
|
||||
# BOTCONFIG does not exist, create
|
||||
[ ! -f "${BOTCONFIG}.jssh" ] &&
|
||||
printf '["bot_config_key"]\t"config_key_value"\n' >"${BOTCONFIG}.jssh"
|
||||
@ -193,7 +204,7 @@ fi
|
||||
# read BOTTOKEN from bot database if not set
|
||||
if [ -z "${BOTTOKEN}" ]; then
|
||||
BOTTOKEN="$(getConfigKey "bottoken")"
|
||||
if [[ -z "${BOTTOKEN}" && "${1}" != "help" ]]; then
|
||||
if [ -z "${BOTTOKEN}" ]; then
|
||||
echo -e "${ORANGE}Warning: can't get bot token, try to recover working config.${NC}"
|
||||
if [ -r "${BOTCONFIG}.jssh.ok" ]; then
|
||||
cp "${BOTCONFIG}.jssh.ok" "${BOTCONFIG}.jssh"
|
||||
@ -1115,16 +1126,6 @@ if [ "${SOURCE}" != "yes" ]; then
|
||||
_is_function job_control || { echo -e "${RED}Module background is not availible!${NC}"; exit 3; }
|
||||
job_control "$1"
|
||||
;;
|
||||
"help")
|
||||
HELP="README"
|
||||
if [ -n "${CLEAR}" ];then
|
||||
_exists w3m && w3m "$HELP.html" && exit
|
||||
_exists lynx && lynx "$HELP.html" && exit
|
||||
_exists less && less "$HELP.txt" && exit
|
||||
fi
|
||||
cat "$HELP.txt"
|
||||
exit
|
||||
;;
|
||||
*)
|
||||
echo -e "${RED}${REALME##*/}: unknown command${NC}"
|
||||
echo -e "${ORANGE}Available commands: ${GREY}start, stop, status, stats, broadcast, help, suspendback, resumeback, killback${NC}"
|
||||
|
Loading…
Reference in New Issue
Block a user