mirror of
https://github.com/TotalFreedomMC/TotalFreedomBot.git
synced 2024-12-22 15:44:57 +00:00
disconnect after command
bot now disconnects and reconnects to telnet for every command
This commit is contained in:
parent
0aaaa23c85
commit
8ab03acfa9
1 changed files with 19 additions and 11 deletions
24
events.py
24
events.py
|
@ -23,26 +23,34 @@ class Events(commands.Cog):
|
||||||
telnet_username = config['TELNET_USERNAME']
|
telnet_username = config['TELNET_USERNAME']
|
||||||
telnet_password = config['TELNET_PASSWORD']
|
telnet_password = config['TELNET_PASSWORD']
|
||||||
|
|
||||||
telnet_ip_2 = config['SERVER_IP_2']
|
|
||||||
|
|
||||||
self.bot.reaction_roles = []
|
self.bot.reaction_roles = []
|
||||||
self.bot.telnet_object = telnet(
|
self.bot.telnet_object = telnet(
|
||||||
telnet_ip, telnet_port, telnet_username, telnet_password)
|
telnet_ip, telnet_port, telnet_username, telnet_password)
|
||||||
|
try:
|
||||||
self.bot.telnet_object.connect()
|
self.bot.telnet_object.connect()
|
||||||
|
except ConnectionError:
|
||||||
self.bot.telnet_object_2 = telnet(
|
print("Freedom-01 Telnet failed to connect")
|
||||||
telnet_ip_2, telnet_port, telnet_username, telnet_password)
|
else:
|
||||||
self.bot.telnet_object_2.connect()
|
|
||||||
|
|
||||||
print(
|
print(
|
||||||
f'[{str(datetime.utcnow().replace(microsecond=0))[11:]} INFO]: [TELNET] Bot logged into Telnet as: {self.bot.telnet_object.username}')
|
f'[{str(datetime.utcnow().replace(microsecond=0))[11:]} INFO]: [TELNET] Bot logged into Telnet as: {self.bot.telnet_object.username}')
|
||||||
|
|
||||||
self.bot.reaction_roles = config['reaction_roles']
|
reaction_data = read_json('config')
|
||||||
|
self.bot.reaction_roles = reaction_data['reaction_roles']
|
||||||
|
|
||||||
|
self.bot.command_cache = {}
|
||||||
|
print("command cache initalized")
|
||||||
print(f'[{str(datetime.utcnow().replace(microsecond=0))[11:]} INFO]: [Client] {self.bot.user.name} is online.')
|
print(f'[{str(datetime.utcnow().replace(microsecond=0))[11:]} INFO]: [Client] {self.bot.user.name} is online.')
|
||||||
game = discord.Game('play.totalfreedom.me')
|
game = discord.Game('play.totalfreedom.me')
|
||||||
await self.bot.change_presence(status=discord.Status.online, activity=game)
|
await self.bot.change_presence(status=discord.Status.online, activity=game)
|
||||||
|
|
||||||
|
print(f'[{datetime.utcnow().replace(microsecond=0)} INFO]: [Blacklist] Current blacklist:')
|
||||||
|
for user_id in self.bot.blacklisted_users:
|
||||||
|
user = self.bot.get_user(user_id)
|
||||||
|
if user:
|
||||||
|
print(f'[{datetime.utcnow().replace(microsecond=0)} INFO]: [Blacklist] - {user.name}')
|
||||||
|
else:
|
||||||
|
print(f'[{datetime.utcnow().replace(microsecond=0)} INFO]: [Blacklist] - {user_id}')
|
||||||
|
|
||||||
guild_count = len(self.bot.guilds)
|
guild_count = len(self.bot.guilds)
|
||||||
print(
|
print(
|
||||||
f'[{str(datetime.utcnow().replace(microsecond=0))[11:]} INFO]: [Guilds] bot currently in {guild_count} guilds.')
|
f'[{str(datetime.utcnow().replace(microsecond=0))[11:]} INFO]: [Guilds] bot currently in {guild_count} guilds.')
|
||||||
|
|
Loading…
Reference in a new issue