Update miscellaneous.py

This commit is contained in:
Elmon11 2021-01-07 20:16:57 +01:00 committed by GitHub
parent 9cab9da5fc
commit 0322c158f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,9 +2,10 @@ import asyncio
from datetime import datetime from datetime import datetime
import discord import discord
from checks import *
from discord.ext import commands from discord.ext import commands
from functions import *
from checks import is_dev, is_tf_developer
from functions import read_json, write_json
class Miscellaneous(commands.Cog): class Miscellaneous(commands.Cog):
@ -41,7 +42,6 @@ class Miscellaneous(commands.Cog):
self.bot.telnet_object_2.session.close() self.bot.telnet_object_2.session.close()
self.bot.telnet_object.connect(args[1]) self.bot.telnet_object.connect(args[1])
self.bot.telnet_object_2.connect(args[1]) self.bot.telnet_object_2.connect(args[1])
self.bot.telnet_object.username
config = read_json('config') config = read_json('config')
config['TELNET_USERNAME'] = self.bot.telnet_object.username config['TELNET_USERNAME'] = self.bot.telnet_object.username
write_json('config', config) write_json('config', config)
@ -62,7 +62,7 @@ class Miscellaneous(commands.Cog):
bytes(command, 'ascii') + b"\r\n") bytes(command, 'ascii') + b"\r\n")
self.bot.telnet_object.session.read_until( self.bot.telnet_object.session.read_until(
bytes(f'{time_sent} INFO]:', 'ascii'), 2) bytes(f'{time_sent} INFO]:', 'ascii'), 2)
if ctx.channel == ctx.guild.get_channel(server_chat): if ctx.channel == ctx.guild.get_channel(self.bot.server_chat):
self.bot.telnet_object.session.read_until( self.bot.telnet_object.session.read_until(
bytes('\r\n', 'ascii'), 2) bytes('\r\n', 'ascii'), 2)
next_line = self.bot.telnet_object.session.read_until( next_line = self.bot.telnet_object.session.read_until(
@ -77,7 +77,7 @@ class Miscellaneous(commands.Cog):
@is_dev() @is_dev()
@commands.command() @commands.command()
async def debug(self, ctx, *, cmd): async def debug(self, ctx, *, cmd):
'Executes a line of code' """Executes a line of code"""
try: try:
result = eval(cmd) result = eval(cmd)
if asyncio.iscoroutine(result): if asyncio.iscoroutine(result):