forked from Raiza.dev/EliteBot
Compare commits
No commits in common. "eeb38858db2214ef6c967d934c49d6086379b98f" and "0ad11dce511099ec3eb620085781e3b86159acc6" have entirely different histories.
eeb38858db
...
0ad11dce51
2 changed files with 1 additions and 11 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -4,5 +4,4 @@ logs
|
||||||
test.json
|
test.json
|
||||||
elitebot
|
elitebot
|
||||||
.idea
|
.idea
|
||||||
venv
|
venv
|
||||||
test.yaml
|
|
|
@ -156,21 +156,12 @@ class Bot:
|
||||||
self.connected = False
|
self.connected = False
|
||||||
return
|
return
|
||||||
|
|
||||||
async def send_ping(self):
|
|
||||||
while True:
|
|
||||||
await asyncio.sleep(60)
|
|
||||||
await self.ircsend(f'PING :{self.config["Connection"].get("Hostname")}')
|
|
||||||
|
|
||||||
async def start(self):
|
async def start(self):
|
||||||
ping_task = None
|
|
||||||
while True:
|
while True:
|
||||||
if not self.connected:
|
if not self.connected:
|
||||||
try:
|
try:
|
||||||
await self.connect()
|
await self.connect()
|
||||||
self.connected = True
|
self.connected = True
|
||||||
# Start the ping task after the bot has connected
|
|
||||||
if ping_task is None or ping_task.done():
|
|
||||||
ping_task = asyncio.create_task(self.send_ping())
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.logger.error(f'Connection error: {e}')
|
self.logger.error(f'Connection error: {e}')
|
||||||
await asyncio.sleep(60)
|
await asyncio.sleep(60)
|
||||||
|
|
Loading…
Add table
Reference in a new issue