Compare commits

...

4 commits

Author SHA1 Message Date
elmon 8ab03acfa9
disconnect after command
bot now disconnects and reconnects to telnet for every command
2022-03-28 14:51:45 +02:00
elmon 0aaaa23c85
Update server_commands.py 2021-12-23 21:43:00 +01:00
elmon e81d8e71d7
Merge pull request #4 from FolfyBlue/patch-1
Don't read the config twice
2021-12-23 21:42:02 +01:00
Folfy Blue 9078a583e2
Don't read the config twice
It's already loaded above lol
2021-08-27 07:09:52 +02:00
2 changed files with 18 additions and 11 deletions

View file

@ -362,7 +362,7 @@ class ServerCommands(commands.Cog, name="Server Commands"):
await report.delete()
time = embed.timestamp
difference = datetime.now() - time
if difference.days >= 0:
if difference.days >= 1:
await report.delete()
await archived_reports_channel.send("Message archived because it is older than 24 hours", embed=embed)
count += 1

View file

@ -23,27 +23,34 @@ class Events(commands.Cog):
telnet_username = config['TELNET_USERNAME']
telnet_password = config['TELNET_PASSWORD']
telnet_ip_2 = config['SERVER_IP_2']
self.bot.reaction_roles = []
self.bot.telnet_object = telnet(
telnet_ip, telnet_port, telnet_username, telnet_password)
self.bot.telnet_object.connect()
self.bot.telnet_object_2 = telnet(
telnet_ip_2, telnet_port, telnet_username, telnet_password)
self.bot.telnet_object_2.connect()
print(
f'[{str(datetime.utcnow().replace(microsecond=0))[11:]} INFO]: [TELNET] Bot logged into Telnet as: {self.bot.telnet_object.username}')
try:
self.bot.telnet_object.connect()
except ConnectionError:
print("Freedom-01 Telnet failed to connect")
else:
print(
f'[{str(datetime.utcnow().replace(microsecond=0))[11:]} INFO]: [TELNET] Bot logged into Telnet as: {self.bot.telnet_object.username}')
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.')
game = discord.Game('play.totalfreedom.me')
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)
print(
f'[{str(datetime.utcnow().replace(microsecond=0))[11:]} INFO]: [Guilds] bot currently in {guild_count} guilds.')