diff --git a/DiscordBot/badCurrentStory.mp3 b/DiscordBot/badCurrentStory.mp3 new file mode 100644 index 0000000..761096c Binary files /dev/null and b/DiscordBot/badCurrentStory.mp3 differ diff --git a/DiscordBot/badCurrentTTS.mp3 b/DiscordBot/badCurrentTTS.mp3 new file mode 100644 index 0000000..f19eba2 Binary files /dev/null and b/DiscordBot/badCurrentTTS.mp3 differ diff --git a/DiscordBot/currentTTS.wav b/DiscordBot/currentTTS.wav new file mode 100644 index 0000000..076570f Binary files /dev/null and b/DiscordBot/currentTTS.wav differ diff --git a/DiscordBot/madlibsDiscord.py b/DiscordBot/madlibsDiscord.py index ddc3f69..1230675 100755 --- a/DiscordBot/madlibsDiscord.py +++ b/DiscordBot/madlibsDiscord.py @@ -8,7 +8,7 @@ testing = 1 # Import the libraries we will use #from mega import Mega import tracemalloc -from concurrent.futures import ProcessPoolExecutor +#from concurrent.futures import ProcessPoolExecutor from datetime import datetime from gtts import gTTS import discord @@ -17,7 +17,8 @@ import re import sys import random import os -import asyncio, threading +import asyncio +from threading import Thread import ffmpeg #import talkey @@ -110,7 +111,8 @@ async def madlibsLoop(): voice.stop() print("Attempting to play audio"+'\n') voice.play(discord.FFmpegPCMAudio("currentTTS.wav")) - message = await self.bot.wait_for('message', check=lambda messages: message.author.id == ctx.author.id and ctx.channel.id == message == ctx.message.id, timeout=30.0) + message = await client.wait_for('message') + # , check=lambda messages: message.author.id == ctx.author.id and ctx.channel.id == message == ctx.message.id, timeout=30.0 replaceVar = message.content print("You gave me: "+replaceVar) replaceList.append(replaceVar) @@ -194,24 +196,6 @@ async def madlibsLoop(): else: discordFile = discord.File(saveFile+'.wav', filename=saveFile+'.wav') await channel.send(file=discordFile) - -async def messageListening(): - global messageslist, messageAuthorList, logMessages - print("Now Listening for messages...") - messagesList= [] - messageAuthorList = [] - print("Loop start!") - x = 0 - while True: - async def on_message(message): - raw_message = await client.wait_for('message') - if logMessages == True: - print("Loop Count: "+str(x)) - messagesList.append(raw_message.content) - messageAuthorList.append(raw_message.author.nick) - if logMessages == True: - print("Message from "+messageAuthorList[x]+": "+messagesList[x]) - x += 1 #await client.process_commands(message) #Setup Discord functions and announce on discord that we are ready @@ -229,10 +213,12 @@ class MyClient(discord.Client): async def on_message(self, message, pass_context=True): if message.content == 'mad!madlibs': + print("lol") channel = client.get_channel(656233549837631508) await madlibsLoop() await channel.send("Done!") #Turn on message logging +""" async def on_message(self, message, pass_context=True): if message.content == 'mad!logMessagesOn': pass @@ -256,11 +242,32 @@ class MyClient(discord.Client): else: channel = client.get_channel(656233549837631508) await channel.send("You are not authorized to use this command! Only @CCF_100#1050 may use this command!") +""" #Calls message listening function. - logMessages = False - loop = asyncio.get_event_loop() - asyncio.create_task(messageListening()) - print("lol3214") + #logMessages = False + #async def messageListening(): + #global messageslist, messageAuthorList, logMessages + #print("Now Listening for messages...") + #messagesList= [] + #messageAuthorList = [] + #print("Loop start!") + #x = 0 + #while True: + #async def on_message(message): + #raw_message = await client.wait_for('message') + #if logMessages == True: + #print("Loop Count: "+str(x)) + #messagesList.append(raw_message.content) + #messageAuthorList.append(raw_message.author.nick) + #if logMessages == True: + #print("Message from "+messageAuthorList[x]+": "+messagesList[x]) + #x += 1 + #Start messageListening in a new thread to prevent it from stalling the rest of the script + #def startMessageListening(): + #asyncio.set_event_loop(loop) + #loop.run_forever() new_loop = asyncio.new_event_loop() + #t = Thread(target=startMessageListening, args=(new_loop,)) + #t.start() #Disconnect Voice #await asyncio.sleep(60) #voiceChannel = client.get_channel(682688245964079127) diff --git a/DiscordBot/stories.txt b/DiscordBot/stories.txt new file mode 100644 index 0000000..01b97c6 --- /dev/null +++ b/DiscordBot/stories.txt @@ -0,0 +1,12 @@ + + on down! You're the next contestant on 's new gameshow, MadLib! Here's how it works. You will over a at a rate of mph. After you jump over that item, you will over to the and press the at the end. time wins! Oh. I forgot to introduce our host. He's a person who can't wait to in to the show. Please welcome, ! Alright players, on your mark. Get set. ! Alright, here goes on the first stage of the competition. And.. WOAH! He just over the thing! That's gonna hurt him tommorow. But it'll be all worth it after he wins the grand prize of dollars! Which he says will go towards . Very investment, but it's his money! Here he comes around the second leg. AND WOAH, AGAIN HE LOOKS ON NETWORK TELEVISION! This is what primetime is all about here on the network of . And, he presses it! He finishes with a time of