🐛 Fixed message deletion bug

Fixed bug where the bedreNetflix commands would delete the old response
instead of editing it
This commit is contained in:
NikolajDanger
2021-04-06 15:49:33 +02:00
parent bf9bdeb19c
commit cc0e65311f
2 changed files with 18 additions and 15 deletions

View File

@ -62,10 +62,10 @@ class BedreNetflix():
await message.add_reaction("")
#Adds the requested movie to Bedre Netflix
async def addMovie(self,channel,imdbId):
async def addMovie(self, message, imdbId):
if imdbId == None:
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:
self.bot.log("Trying to add movie "+str(imdbId))
apiKey = self.bot.credentials.radarrKey
@ -81,12 +81,13 @@ class BedreNetflix():
r = requests.post(url= self.radarrURL+"movie?apikey="+apiKey,json = postData)
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")
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:
await channel.send("Something went wrong")
await message.edit(embed = None, content = "Something went wrong")
self.bot.log(str(r.status_code)+" "+r.reason)
#Returns a list of no more than 5 options when user requests a show
@ -140,10 +141,10 @@ class BedreNetflix():
await message.add_reaction("")
#Adds the requested show to Bedre Netflix
async def addShow(self,channel,imdbName):
async def addShow(self, message, imdbName):
if imdbName == None:
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:
self.bot.log("Trying to add show "+str(imdbName))
apiKey = self.bot.credentials.sonarrKey
@ -159,12 +160,13 @@ class BedreNetflix():
r = requests.post(url= self.sonarrURL+"series?apikey="+apiKey,json = postData)
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")
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:
await channel.send("Something went wrong")
await message.edit(embed = None, content = "Something went wrong")
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