Skip to content

Commit

Permalink
remove unused music handler from install (#104)
Browse files Browse the repository at this point in the history
* remove unused music handler from install
  • Loading branch information
AbhiTheModder authored Nov 29, 2024
1 parent d54d78e commit 4b4e336
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 34 deletions.
3 changes: 0 additions & 3 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ STRINGSESSION={@string_session}
# Set if you want to use music bot
SECOND_SESSION={@second_session}

# Music handler for music bot
MUSIC_HANDLER={@music_handler}

# PM LIMIT for AntiPM plugin
PM_LIMIT={@pm_limit}

Expand Down
54 changes: 23 additions & 31 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ PACKAGE_MANAGER=""

# Ensure the script is run with root privileges
if [[ $UID != 0 ]]; then
printf "${YELLOW}This script requires root privileges.${NC}\n"
printf "${YELLOW}This script requires root privileges.${NC}\n" # skipcq
printf "Please enter the root password to continue.\n"
exec sudo "$0" "$@"
else
printf "${YELLOW}Running with root privileges${NC}\n"
printf "${YELLOW}Running with root privileges${NC}\n" # skipcq
fi

# Detect available package manager
Expand All @@ -29,12 +29,12 @@ elif command -v yum &>/dev/null; then
elif command -v pacman &>/dev/null; then
PACKAGE_MANAGER="pacman"
else
printf "${RED}Unsupported package manager. Please use a compatible distribution or update the installer script.${NC}\n"
printf "${RED}Unsupported package manager. Please use a compatible distribution or update the installer script.${NC}\n" # skipcq
exit 1
fi

if command -v termux-setup-storage; then
printf "${RED}For termux, please use https://raw.githubusercontent.com/The-MoonTg-project/Moon-Userbot/main/termux-install.sh${NC}\n"
printf "${RED}For termux, please use https://raw.githubusercontent.com/The-MoonTg-project/Moon-Userbot/main/termux-install.sh${NC}\n" # skipcq
exit 1
fi

Expand All @@ -61,22 +61,22 @@ esac
if [[ -d "Moon-Userbot" && "$(basename "$PWD")" != "Moon-Userbot" ]]; then
cd Moon-Userbot || exit 2
elif [[ "$(basename "$PWD")" == "Moon-Userbot" && -f ".env.dist" && -f "main.py" && -d "modules" ]]; then
printf "${BLUE}Already inside the Moon-Userbot repo, proceeding...${NC}\n"
printf "${BLUE}Already inside the Moon-Userbot repo, proceeding...${NC}\n" # skipcq
else
git clone https://github.com/The-MoonTg-project/Moon-Userbot || exit 2
cd Moon-Userbot || exit 2
fi

if [[ -f ".env" ]] && [[ -f "my_account.session" ]]; then
printf "${GREEN}It seems that Moon-Userbot is already installed. Exiting...${NC}\n"
printf "${GREEN}It seems that Moon-Userbot is already installed. Exiting...${NC}\n" # skipcq
exit
fi

# Prompt user if they want to proceed with creating a virtual environment
printf "${YELLOW}It's recommended to use a virtual environment for Python projects.${NC}\n"
printf "${YELLOW}It's recommended to use a virtual environment for Python projects.${NC}\n" # skipcq
printf "Note: If your drive resources are very limited, you might consider not creating a virtual environment, but it shouldn't be rejected otherwise unless you know what you're doing.\n"
printf "If you're unsure, it's better to create a virtual environment.\n"
printf "${INPUT}Would you like to create a virtual environment? (Y/n)${NC} > "
printf "${INPUT}Would you like to create a virtual environment? (Y/n)${NC} > " # skipcq
read -r create_venv

if [[ "$create_venv" != "n" ]] && [[ "$create_venv" != "N" ]]; then
Expand All @@ -99,19 +99,19 @@ pip install -U -r requirements.txt || exit 2
# Prompt for API_ID and API_HASH
printf "Enter API_ID and API_HASH\n"
printf "You can get it here -> https://my.telegram.org/\n"
printf "Leave empty to use defaults (please note that using default keys is a ${RED}very bad idea${NC} and significantly increases your ban chances)\n"
printf "Leave empty to use defaults (please note that using default keys is a ${RED}very bad idea${NC} and significantly increases your ban chances)\n" # skipcq
read -r -p "API_ID > " api_id

# Default API_ID and API_HASH
if [[ $api_id = "" ]]; then
printf "${RED}You have chosen to use the default API_ID and API_HASH, which is strongly discouraged.${NC}\n"
printf "${YELLOW}Please type${NC} '${BLUE}I agree${NC}'${YELLOW} to confirm that you understand the risks and still wish to proceed.${NC}\n"
printf "${RED}You have chosen to use the default API_ID and API_HASH, which is strongly discouraged.${NC}\n" # skipcq
printf "${YELLOW}Please type${NC} '${BLUE}I agree${NC}'${YELLOW} to confirm that you understand the risks and still wish to proceed.${NC}\n" # skipcq
read -r -p "Confirmation > " confirmation
if [[ $confirmation = "I agree" ]]; then
api_id="2040"
api_hash="b18441a1ff607e10a989891a5462e627"
else
printf "${RED}Confirmation not provided. Exiting...${NC}\n"
printf "${RED}Confirmation not provided. Exiting...${NC}\n" # skipcq
exit 1
fi
else
Expand All @@ -121,7 +121,7 @@ fi
# PM PERMIT warn limit is the number of messages a user can receive from others before giving them a warning, requires `antipm` plugin to be enabled
printf "SET PM PERMIT warn limit\n"
# Now below is more clear version:
printf "The number of messages others can send you before receiving a warning, and eventually a ban or leave empty for default (3), requires $(antipm) plugin to be enabled\n"
printf "The number of messages others can send you before receiving a warning, and eventually a ban or leave empty for default (3), requires antipm plugin to be enabled\n"
read -r -p "PM_LIMIT warn limit > " pm_limit

if [[ $pm_limit = "" ]]; then
Expand All @@ -138,13 +138,6 @@ if [[ $musicbot = "y" ]]; then
if [[ $second_session = "" ]]; then
printf "SECOND_SESSION not provided by user\n"
second_session=""
else
printf "Please provide handler to be used by musicbotn\n"
read -r -p "MUSIC_HANDLER > " music_handler
if [[ $music_handler = "" ]]; then
printf "MUSIC_HANDLER not provided by user\n"
music_handler=""
fi
fi
fi

Expand Down Expand Up @@ -199,7 +192,7 @@ fi

while true; do
# Prompt for database type and database URL if MongoDB is selected
printf "${YELLOW}Choose database type:${NC}\n"
printf "${YELLOW}Choose database type:${NC}\n" # skipcq
printf "[1] MongoDB db_url\n"
printf "[2] MongoDB localhost\n"
printf "[3] Sqlite (default)\n"
Expand All @@ -224,7 +217,7 @@ while true; do
if systemctl status mongodb; then
wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | apt-key add -
source /etc/os-release
printf "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu ${UBUNTU_CODENAME}/mongodb-org/5.0 multiverse\n" | tee /etc/apt/sources.list.d/mongodb-org-5.0.list
printf "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu %s/mongodb-org/5.0 multiverse\n" "${UBUNTU_CODENAME}" | tee /etc/apt/sources.list.d/mongodb-org-5.0.list
apt update
apt install mongodb -y
systemctl daemon-reload
Expand All @@ -243,7 +236,7 @@ while true; do
break
;;
*)
printf "${RED}Invalid choice!${NC}\n"
printf "${RED}Invalid choice!${NC}\n" # skipcq
;;
esac
done
Expand All @@ -267,7 +260,6 @@ VCA_API_KEY=${vca_api_key}
COHERE_KEY=${cohere_key}
PM_LIMIT=${pm_limit}
SECOND_SESSION=${second_session}
MUSIC_HANDLER=${music_handler}
EOL

# Adjust the ownership of the Moon-Userbot directory
Expand All @@ -276,7 +268,7 @@ chown -R $SUDO_USER:$SUDO_USER .
# Configure the bot based on selected installation type
while true; do
# Prompt for installation type and execute accordingly
printf "${YELLOW}Choose installation type:${NC}\n"
printf "${YELLOW}Choose installation type:${NC}\n" # skipcq
printf "[1] PM2\n"
printf "[2] Systemd service\n"
printf "[3] Custom (default)\n"
Expand All @@ -300,13 +292,13 @@ while true; do
su -c "pm2 start main.py --name Moon --interpreter python3" $SUDO_USER
su -c "pm2 save" $SUDO_USER

printf "${GREEN}============================\\n"
printf "${GREEN}============================\\n" # skipcq
printf "Great! Moon-Userbot installed successfully and running now!\n"
printf "Installation type: PM2\n"
printf "Start with: \"pm2 start Moon\"\n"
printf "Stop with: \"pm2 stop Moon\"\n"
printf "Process name: Moon\n"
printf "============================${NC}\n"
printf "============================${NC}\n" # skipcq
break
;;
2)
Expand All @@ -327,20 +319,20 @@ EOL
systemctl start Moon
systemctl enable Moon

printf "${GREEN}============================\\n"
printf "${GREEN}============================\\n" # skipcq
printf "Great! Moon-Userbot installed successfully and running now!\n"
printf "Installation type: Systemd service\n"
printf "Start with: \"sudo systemctl start Moon\"\n"
printf "Stop with: \"sudo systemctl stop Moon\"\n"
printf "============================${NC}\n"
printf "============================${NC}\n" # skipcq
break
;;
3)
printf "${GREEN}============================\\n"
printf "${GREEN}============================\\n" # skipcq
printf "Great! Moon-Userbot installed successfully!\n"
printf "Installation type: Custom\n"
printf "Start with: \"python3 main.py\"\n"
printf "============================${NC}\n"
printf "============================${NC}\n" # skipcq
break
;;
*)
Expand Down

0 comments on commit 4b4e336

Please sign in to comment.