Tweaked code and improved security
This commit is contained in:
parent
04d4ff85f7
commit
28974e050a
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
madlibs/botID.txt
|
||||||
|
|
@ -18,7 +18,6 @@ async def gameLoop():
|
|||||||
await client.change_presence(activity=discord.Game(name='madlibs.py'))
|
await client.change_presence(activity=discord.Game(name='madlibs.py'))
|
||||||
# Introduce yourself
|
# Introduce yourself
|
||||||
channel = client.get_channel(656233549837631508)
|
channel = client.get_channel(656233549837631508)
|
||||||
print(discord.user)
|
|
||||||
await channel.send("**<<madlibsDiscord.py - Written by Caleb Fontenot>>**")
|
await channel.send("**<<madlibsDiscord.py - Written by Caleb Fontenot>>**")
|
||||||
await channel.send("Initial project started on **July 13, 2019**")
|
await channel.send("Initial project started on **July 13, 2019**")
|
||||||
await channel.send("Discord Bot started on **December 16, 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):
|
async def on_message(self, message, pass_context=True):
|
||||||
if message.content == 'mad!start':
|
if message.content == 'mad!start':
|
||||||
channel = client.get_channel(656233549837631508)
|
channel = client.get_channel(656233549837631508)
|
||||||
loop = asyncio.get_event_loop()
|
await gameLoop()
|
||||||
#await channel.send("Event Loop is currently: "+str(loop))
|
|
||||||
loop.run_until_complete(gameLoop())
|
|
||||||
await channel.send("Done!")
|
await channel.send("Done!")
|
||||||
#Run main Game loop
|
#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
|
# Connect Bot To Discord and start running
|
||||||
client = MyClient()
|
client = MyClient()
|
||||||
client.run('')
|
client.run(BotID)
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user