Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ Before using this script, ensure you have the following dependencies installed:
- `CONFIG_CHATID`: Your Telegram channel/group chat ID.
- `CONFIG_BOT_TOKEN`: Your Telegram bot token.
- `CONFIG_ERROR_CHATID`: (Optional) A separate chat ID for error logs.
- `CONFIG_SEND_STICKER`: Whether the bot should send stickers to Telegram.
- `CONFIG_STICKER_URL`: The link to the sticker image.
- `CONFIG_PDUP_API`: Your PixelDrain API key.
- `CONFIG_GOFILE`: Whether to upload the zip to Gofile.
- `POWEROFF`: Set to `true` to power off the server after the build is complete.

## Usage
Expand Down
18 changes: 12 additions & 6 deletions ci_bot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ ROOT_DIRECTORY="$(pwd)"
ROM_NAME="$(sed "s#.*/##" <<<"$(pwd)")"
ANDROID_VERSION=$(grep -oP '(?<=android-)[0-9]+' .repo/manifests/default.xml | head -n1 || echo "N/A")
OUT_DIR="$ROOT_DIRECTORY/out/target/product/$DEVICE"
STICKER_URL="https://raw.githubusercontent.com/Weebo354342432/reimagined-enigma/main/update.webp"

# --- Helper Functions ---

Expand Down Expand Up @@ -161,6 +160,7 @@ upload_file_pd() {
fi
}

# Function to upload a file to Gofile
upload_file_gofile() {
FILE_UPLOAD_PATH="$1"
GOFILE_SERVER=$(curl -s https://api.gofile.io/servers | grep -oP '"name":"\K[^"]+' | head -n 1)
Expand Down Expand Up @@ -299,7 +299,9 @@ breakfast "$DEVICE"
if [ $? -ne 0 ]; then
build_failed_message=$(generate_telegram_message "🔴" "ROM compilation failed" "" "Failed at running breakfast for $DEVICE.")
edit_message "$build_failed_message" "$CONFIG_CHATID" "$build_message_id"
send_sticker "$STICKER_URL" "$CONFIG_CHATID"
if [[ "$CONFIG_SEND_STICKER" == "true" ]]; then
send_sticker "$CONFIG_STICKER_URL" "$CONFIG_CHATID"
fi
exit 1
fi

Expand Down Expand Up @@ -345,9 +347,11 @@ if ! grep -q "#### build completed successfully" "$ROOT_DIRECTORY/build.log"; th
echo "out/error.log not found, sending full build.log instead."
send_file "$ROOT_DIRECTORY/build.log" "$CONFIG_ERROR_CHATID"
fi

send_sticker "$STICKER_URL" "$CONFIG_CHATID"


if [[ "$CONFIG_SEND_STICKER" == "true" ]]; then
send_sticker "$CONFIG_STICKER_URL" "$CONFIG_CHATID"
fi

# Display the error log in the terminal
if [ -f "out/error.log" ]; then
echo -e "\n${RED}Displaying error log:${RESET}"
Expand Down Expand Up @@ -398,7 +402,9 @@ else
build_finished_message=$(generate_telegram_message "🟢" "ROM compiled successfully!" "$details" "Compilation took $build_duration.")

edit_message "$build_finished_message" "$CONFIG_CHATID" "$build_message_id"
send_sticker "$STICKER_URL" "$CONFIG_CHATID"
if [[ "$CONFIG_SEND_STICKER" == "true" ]]; then
send_sticker "$CONFIG_STICKER_URL" "$CONFIG_CHATID"
fi
fi

if [[ "$POWEROFF" == "true" ]]; then
Expand Down
2 changes: 2 additions & 0 deletions config.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ CONFIG_OFFICIAL_FLAG=""
CONFIG_CHATID=""
CONFIG_BOT_TOKEN=""
CONFIG_ERROR_CHATID="" # Optional: If not set, errors are sent to CONFIG_CHATID
CONFIG_SEND_STICKER="true"
CONFIG_STICKER_URL="https://raw.githubusercontent.com/Weebo354342432/reimagined-enigma/main/update.webp"

# PixelDrain API Key
CONFIG_PDUP_API=""
Expand Down