Browse Source

Support elktail w/o comment chunks

master
Purpur 4 years ago
committed by GitHub
parent
commit
2aa0539dfc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 38
      bot.py

38
bot.py

@ -156,26 +156,6 @@ async def on_message(message):
elif discord_id_already_exists:
await channel.send('Sorry, your Discord account is already linked to a panel account. If you would like to link your Discord account to a different panel account, please unlink your Discord account first by reacting in the #verification channel.')
logging.info("Duplicate Discord message sent to " + message.author.name + "#" + str(message.author.discriminator) + " (" + str(message.author.id) + ")" + " for using API key " + message.content + " linked to client_id " + str(json_response['attributes']['id']))
# Makes json pretty with indentations and stuff, then writes to file
# json_dumps = json.dumps(json_response, indent = 2)
# file = open("data.json", "w")
# file.write(json_dumps)
# file.close()
# linked_servers = {}
# linked_servers['server'] = []
# for server in json_response['data']:
# server_owner = server['attributes']['server_owner']
# server_uuid = server['attributes']['uuid']
# server_name = server['attributes']['name']
# server_node = server['attributes']['node']
# message_sender = message.author.id
# info = str(server_owner) + server_uuid + server_name + server_node + str(message_sender)
# logging.info(info)
# file = open('/home/container/data/' + str(message.author.id) + '.json', "a")
# file.write(info + '\n')
# file.close()
else:
#Says if API key is the corect # of characters but invalid
await channel.send("Sorry, that appears to be an invalid API key.")
@ -338,24 +318,6 @@ async def updater():
await member.edit(roles=[])
logging.info("removed discord_id " + str(client['discord_id']) + " with client_id " + str(client['client_id']) + " and INVALID client_api_key " + client['client_api_key'])
else:
# file = open('oldusers.json', 'r')
# olddata = json.load(file)
# file.close()
# Checks if user exists. If so, skips adding them to users.json
# already_exists = False
# for olduser in olddata['users']:
# if olduser['discord_id'] == json_response['attributes']['id']:
#
# if already_exists == False:
# olddata['users'].append({
# 'discord_id': message.author.id,
# 'client_id': json_response['attributes']['id'],
# 'client_api_key': message.content
# })
# json_dumps = json.dumps(olddata, indent = 2)
# file = open('oldusers.json', 'w')
# file.write(json_dumps)
# file.close()
data['users'].pop(i)
json_dumps = json.dumps(data, indent = 2)
file = open('users.json', 'w')

Loading…
Cancel
Save