Update miscellaneous.py

This commit is contained in:
Elmon11 2020-10-31 21:05:39 +01:00 committed by GitHub
parent 20d1ef19b1
commit a2b3020e6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,10 +2,12 @@ import discord
import asyncio import asyncio
import telnet import telnet
import time import time
import events
from datetime import datetime from datetime import datetime
from discord.ext import commands from discord.ext import commands
from checks import * from checks import *
from functions import *
class Miscellaneous(commands.Cog): class Miscellaneous(commands.Cog):
def __init__(self, bot): def __init__(self, bot):
@ -36,7 +38,12 @@ class Miscellaneous(commands.Cog):
em.colour = 0x00FF00 em.colour = 0x00FF00
elif args[0] == 'name': elif args[0] == 'name':
try: try:
self.bot.telnet_object.session.close()
self.bot.telnet_object.connect(args[1]) self.bot.telnet_object.connect(args[1])
events.telnet_username = self.bot.telnet_object.username
config = read_json('config')
config['TELNET_USERNAME'] = self.bot.telnet_object.username
write_json('config', config)
except Exception as e: except Exception as e:
em.description = f'Failed config edit: {e}' em.description = f'Failed config edit: {e}'
em.colour = 0xFF0000 em.colour = 0xFF0000