From 28974e050a60c43129527affcc818952143132d4 Mon Sep 17 00:00:00 2001 From: Caleb Fontenot Date: Mon, 16 Dec 2019 23:22:46 -0600 Subject: [PATCH] Tweaked code and improved security --- .gitignore | 2 ++ madlibs/madlibsDiscord.py | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a8b1f4d --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +madlibs/botID.txt + diff --git a/madlibs/madlibsDiscord.py b/madlibs/madlibsDiscord.py index 3f3afcb..373b502 100755 --- a/madlibs/madlibsDiscord.py +++ b/madlibs/madlibsDiscord.py @@ -18,7 +18,6 @@ async def gameLoop(): await client.change_presence(activity=discord.Game(name='madlibs.py')) # Introduce yourself channel = client.get_channel(656233549837631508) - print(discord.user) await channel.send("**<>**") await channel.send("Initial project started on **July 13, 2019**") await channel.send("Discord Bot started on **December 16, 2019**") @@ -146,16 +145,17 @@ class MyClient(discord.Client): async def on_message(self, message, pass_context=True): if message.content == 'mad!start': channel = client.get_channel(656233549837631508) - loop = asyncio.get_event_loop() - #await channel.send("Event Loop is currently: "+str(loop)) - loop.run_until_complete(gameLoop()) + await gameLoop() await channel.send("Done!") #Run main Game loop +# The Discord bot ID isn't stored in this script for security reasons, so we have to go get it +f = open('botID.txt', 'r') +BotID = f.read() # Connect Bot To Discord and start running client = MyClient() -client.run('') +client.run(BotID) exit()