fix launcher
This commit is contained in:
parent
83618522a7
commit
248cb04cbe
4 changed files with 45 additions and 13 deletions
|
|
@ -42,7 +42,7 @@ Fluxer Reaper is a simple tool to help you move an entire Discord server over to
|
||||||
|
|
||||||
## Notes:
|
## Notes:
|
||||||
- The Discord bot has read-only access to the source server. Hence no changes will be made to the source server.
|
- The Discord bot has read-only access to the source server. Hence no changes will be made to the source server.
|
||||||
- Currently Fluxer is unstable probably due to high traffic, migrating servers now will only add to that problem. Only use this for testing purposes for now. [Check status here](https://uptime.reallyaweso.me/status/fluxer)
|
- Currently Fluxer is unstable probably due to high traffic, migrating servers now will only add to that problem. Only use this for testing purposes for now. [Check status here](https://fluxerstatus.com)
|
||||||
|
|
||||||
|
|
||||||
# Bot Setup
|
# Bot Setup
|
||||||
|
|
|
||||||
33
launcher.sh
33
launcher.sh
|
|
@ -4,14 +4,31 @@
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||||
cd "$DIR"
|
cd "$DIR"
|
||||||
|
|
||||||
# Check if venv exists
|
# Check if venv exists, create it if not
|
||||||
if [ -d "$DIR/venv" ]; then
|
if [ ! -d "$DIR/venv" ]; then
|
||||||
# Activate virtual environment
|
echo "Virtual environment not found. Creating one..."
|
||||||
|
python3 -m venv "$DIR/venv"
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Error: Failed to create virtual environment."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Activate and install requirements
|
||||||
source "$DIR/venv/bin/activate"
|
source "$DIR/venv/bin/activate"
|
||||||
# Run the application
|
|
||||||
python3 fluxer-reaper.py "$@"
|
if [ -f "$DIR/requirements.txt" ]; then
|
||||||
|
echo "Installing requirements..."
|
||||||
|
pip install --upgrade pip
|
||||||
|
pip install -r "$DIR/requirements.txt"
|
||||||
|
else
|
||||||
|
echo "Warning: requirements.txt not found. Skipping dependency installation."
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "Error: Virtual environment not found in $DIR/venv"
|
# Activate existing virtual environment
|
||||||
echo "Please ensure you have installed the requirements into a 'venv' folder."
|
source "$DIR/venv/bin/activate"
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Run the application
|
||||||
|
python3 fluxer-reaper.py "$@"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,12 +63,22 @@ class MigrationContext:
|
||||||
await self.fluxer_writer.start()
|
await self.fluxer_writer.start()
|
||||||
|
|
||||||
async def close_connections(self):
|
async def close_connections(self):
|
||||||
await self.discord_reader.close()
|
try:
|
||||||
await self.fluxer_writer.close()
|
await self.discord_reader.close()
|
||||||
|
except Exception as e:
|
||||||
|
logger.debug(f"Error closing Discord reader: {e}")
|
||||||
|
try:
|
||||||
|
await self.fluxer_writer.close()
|
||||||
|
except Exception as e:
|
||||||
|
logger.debug(f"Error closing Fluxer writer: {e}")
|
||||||
|
|
||||||
async def close_fluxer_only(self):
|
async def close_fluxer_only(self):
|
||||||
"""Closes only the Fluxer writer. Pair with start_fluxer_only()."""
|
"""Closes only the Fluxer writer. Pair with start_fluxer_only()."""
|
||||||
await self.fluxer_writer.close()
|
try:
|
||||||
|
await self.fluxer_writer.close()
|
||||||
|
except Exception as e:
|
||||||
|
logger.debug(f"Error closing Fluxer writer: {e}")
|
||||||
|
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
self.is_running = False
|
self.is_running = False
|
||||||
|
|
|
||||||
|
|
@ -589,7 +589,11 @@ class FluxerWriter:
|
||||||
async def close(self):
|
async def close(self):
|
||||||
"""Cleanly close connection and stop bot task."""
|
"""Cleanly close connection and stop bot task."""
|
||||||
if self.bot:
|
if self.bot:
|
||||||
await self.bot.close()
|
try:
|
||||||
|
await self.bot.close()
|
||||||
|
except Exception as e:
|
||||||
|
logger.debug(f"Error closing Fluxer bot: {e}")
|
||||||
|
|
||||||
if self._bot_task:
|
if self._bot_task:
|
||||||
self._bot_task.cancel()
|
self._bot_task.cancel()
|
||||||
try:
|
try:
|
||||||
|
|
@ -598,3 +602,4 @@ class FluxerWriter:
|
||||||
pass
|
pass
|
||||||
self._ready_event.clear()
|
self._ready_event.clear()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue