🔀 Fixed message deletion bug
This commit is contained in:
@ -62,10 +62,10 @@ class BedreNetflix():
|
|||||||
await message.add_reaction("❌")
|
await message.add_reaction("❌")
|
||||||
|
|
||||||
#Adds the requested movie to Bedre Netflix
|
#Adds the requested movie to Bedre Netflix
|
||||||
async def addMovie(self,channel,imdbId):
|
async def addMovie(self, message, imdbId):
|
||||||
if imdbId == None:
|
if imdbId == None:
|
||||||
self.bot.log("Did not find what the user was searching for")
|
self.bot.log("Did not find what the user was searching for")
|
||||||
await channel.send("Try searching for the IMDB id")
|
await message.edit(embed = None, content = "Try searching for the IMDB id")
|
||||||
else:
|
else:
|
||||||
self.bot.log("Trying to add movie "+str(imdbId))
|
self.bot.log("Trying to add movie "+str(imdbId))
|
||||||
apiKey = self.bot.credentials.radarrKey
|
apiKey = self.bot.credentials.radarrKey
|
||||||
@ -81,12 +81,13 @@ class BedreNetflix():
|
|||||||
r = requests.post(url= self.radarrURL+"movie?apikey="+apiKey,json = postData)
|
r = requests.post(url= self.radarrURL+"movie?apikey="+apiKey,json = postData)
|
||||||
|
|
||||||
if r.status_code == 201:
|
if r.status_code == 201:
|
||||||
await channel.send(postData["title"]+" successfully added to Bedre Netflix")
|
await message.edit(embed = None, content = postData["title"]+" successfully added to Bedre Netflix")
|
||||||
self.bot.log("Added "+postData["title"]+" to Bedre Netflix")
|
self.bot.log("Added "+postData["title"]+" to Bedre Netflix")
|
||||||
elif r.status_code == 400:
|
elif r.status_code == 400:
|
||||||
await channel.send("The movie is already requested for or added to Bedre Netflix")
|
text = f"{postData['title']} is either already on Bedre Netflix, downloading, or not available"
|
||||||
|
await message.edit(embed = None, content = text)
|
||||||
else:
|
else:
|
||||||
await channel.send("Something went wrong")
|
await message.edit(embed = None, content = "Something went wrong")
|
||||||
self.bot.log(str(r.status_code)+" "+r.reason)
|
self.bot.log(str(r.status_code)+" "+r.reason)
|
||||||
|
|
||||||
#Returns a list of no more than 5 options when user requests a show
|
#Returns a list of no more than 5 options when user requests a show
|
||||||
@ -140,10 +141,10 @@ class BedreNetflix():
|
|||||||
await message.add_reaction("❌")
|
await message.add_reaction("❌")
|
||||||
|
|
||||||
#Adds the requested show to Bedre Netflix
|
#Adds the requested show to Bedre Netflix
|
||||||
async def addShow(self,channel,imdbName):
|
async def addShow(self, message, imdbName):
|
||||||
if imdbName == None:
|
if imdbName == None:
|
||||||
self.bot.log("Did not find what the user was searching for")
|
self.bot.log("Did not find what the user was searching for")
|
||||||
await channel.send("Try searching for the IMDB id")
|
await message.edit(embed = None, content = "Try searching for the IMDB id")
|
||||||
else:
|
else:
|
||||||
self.bot.log("Trying to add show "+str(imdbName))
|
self.bot.log("Trying to add show "+str(imdbName))
|
||||||
apiKey = self.bot.credentials.sonarrKey
|
apiKey = self.bot.credentials.sonarrKey
|
||||||
@ -159,12 +160,13 @@ class BedreNetflix():
|
|||||||
r = requests.post(url= self.sonarrURL+"series?apikey="+apiKey,json = postData)
|
r = requests.post(url= self.sonarrURL+"series?apikey="+apiKey,json = postData)
|
||||||
|
|
||||||
if r.status_code == 201:
|
if r.status_code == 201:
|
||||||
await channel.send(postData["title"]+" successfully added to Bedre Netflix")
|
await message.edit(embed = None, content = postData["title"]+" successfully added to Bedre Netflix")
|
||||||
self.bot.log("Added a "+postData["title"]+" to Bedre Netflix")
|
self.bot.log("Added a "+postData["title"]+" to Bedre Netflix")
|
||||||
elif r.status_code == 400:
|
elif r.status_code == 400:
|
||||||
await channel.send("The show is already requested for or added to Bedre Netflix")
|
text = f"{postData['title']} is either already on Bedre Netflix, downloading, or not available"
|
||||||
|
await message.edit(embed = None, content = text)
|
||||||
else:
|
else:
|
||||||
await channel.send("Something went wrong")
|
await message.edit(embed = None, content = "Something went wrong")
|
||||||
self.bot.log(str(r.status_code)+" "+r.reason)
|
self.bot.log(str(r.status_code)+" "+r.reason)
|
||||||
|
|
||||||
#Generates a list of all torrents and returns formatted list and whether all torrents are downloaded
|
#Generates a list of all torrents and returns formatted list and whether all torrents are downloaded
|
||||||
|
@ -23,7 +23,7 @@ class EventHandler():
|
|||||||
game = discord.Game("Use /help for commands")
|
game = discord.Game("Use /help for commands")
|
||||||
await self.bot.change_presence(activity=game, status = discord.Status.online)
|
await self.bot.change_presence(activity=game, status = discord.Status.online)
|
||||||
|
|
||||||
async def on_reaction_add(self, reaction, user):
|
async def on_reaction_add(self, reaction : discord.Reaction, user):
|
||||||
if user.bot == False:
|
if user.bot == False:
|
||||||
message = reaction.message
|
message = reaction.message
|
||||||
channel = message.channel
|
channel = message.channel
|
||||||
@ -40,20 +40,21 @@ class EventHandler():
|
|||||||
await self.bot.games.connectFour.placePiece(message, f"#{user.id}", column-1)
|
await self.bot.games.connectFour.placePiece(message, f"#{user.id}", column-1)
|
||||||
elif bedreNetflixMessage and addMovie:
|
elif bedreNetflixMessage and addMovie:
|
||||||
moviePick = emojiToCommand(reaction.emoji)
|
moviePick = emojiToCommand(reaction.emoji)
|
||||||
await message.delete()
|
|
||||||
if moviePick == "none":
|
if moviePick == "none":
|
||||||
imdbID = None
|
imdbID = None
|
||||||
else:
|
else:
|
||||||
imdbID = imdbIds[moviePick-1]
|
imdbID = imdbIds[moviePick-1]
|
||||||
await self.bot.other.bedreNetflix.addMovie(channel,imdbID)
|
await message.clear_reactions()
|
||||||
|
await self.bot.other.bedreNetflix.addMovie(message, imdbID)
|
||||||
elif bedreNetflixMessage and not addMovie:
|
elif bedreNetflixMessage and not addMovie:
|
||||||
showPick = emojiToCommand(reaction.emoji)
|
showPick = emojiToCommand(reaction.emoji)
|
||||||
await message.delete()
|
|
||||||
if showPick == "none":
|
if showPick == "none":
|
||||||
imdbName = None
|
imdbName = None
|
||||||
else:
|
else:
|
||||||
imdbName = imdbIds[showPick-1]
|
imdbName = imdbIds[showPick-1]
|
||||||
await self.bot.other.bedreNetflix.addShow(channel,imdbName)
|
await message.clear_reactions()
|
||||||
|
await self.bot.other.bedreNetflix.addShow(message, imdbName)
|
||||||
|
|
||||||
elif self.bot.databaseFuncs.hangmanReactionTest(channel, message, f"#{user.id}"):
|
elif self.bot.databaseFuncs.hangmanReactionTest(channel, message, f"#{user.id}"):
|
||||||
self.bot.log("They reacted to the hangman message")
|
self.bot.log("They reacted to the hangman message")
|
||||||
if ord(reaction.emoji) in range(127462,127488):
|
if ord(reaction.emoji) in range(127462,127488):
|
||||||
|
Reference in New Issue
Block a user