1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Moved more things around

This commit is contained in:
Steffo 2016-08-12 17:48:35 +02:00
parent 43d5bec4b7
commit 17a2250290

19
main.py
View file

@ -2,6 +2,8 @@ import asyncio
import discord
import json
import overwatch
loop = asyncio.get_event_loop()
d_client = discord.Client()
# Get player database from the db.json file
@ -9,22 +11,17 @@ file = open("db.json")
db = json.load(file)
file.close()
# When the discord client is ready, print something
@d_client.event
async def on_ready():
print("Connessione riuscita!")
print(d_client.user.name)
print(d_client.user.id)
# Get the discord bot token from "discordtoken.txt"
f = open("discordtoken.txt", "r")
token = f.read()
f.close()
# Start discord bot client but ignore events
d_client.start(token)
async def discord_connect():
await d_client.login(token)
print("Discord login was successful!")
d_client.connect() # Something's not right here...
print("Discord connection was successful!")
# List overwatch players
ow_players = list()
@ -32,3 +29,5 @@ for player in db:
if db[player]["overwatch"] is not None:
ow_players.append(db[player]["overwatch"])
# Connect to Discord
loop.run_until_complete(discord_connect())