🐛 Fixed clear reactions bug
Gwendolyn used to throw an error when trying to remove messages from DMs. Now she just doesn't try :thumbs-up:
This commit is contained in:
@ -61,11 +61,18 @@ class BedreNetflix():
|
||||
|
||||
await message.add_reaction("❌")
|
||||
|
||||
message = await ctx.channel.fetch_message(message.id)
|
||||
if message.content != "" and not isinstance(ctx.channel, discord.DMChannel):
|
||||
await message.clear_reactions()
|
||||
|
||||
#Adds the requested movie to Bedre Netflix
|
||||
async def addMovie(self, message, imdbId):
|
||||
async def addMovie(self, message, imdbId, editMessage = True):
|
||||
if imdbId == None:
|
||||
self.bot.log("Did not find what the user was searching for")
|
||||
await message.edit(embed = None, content = "Try searching for the IMDB id")
|
||||
if editMessage:
|
||||
await message.edit(embed = None, content = "Try searching for the IMDB id")
|
||||
else:
|
||||
await message.channel.send("Try searching for the IMDB id")
|
||||
else:
|
||||
self.bot.log("Trying to add movie "+str(imdbId))
|
||||
apiKey = self.bot.credentials.radarrKey
|
||||
@ -81,13 +88,23 @@ class BedreNetflix():
|
||||
r = requests.post(url= self.radarrURL+"movie?apikey="+apiKey,json = postData)
|
||||
|
||||
if r.status_code == 201:
|
||||
await message.edit(embed = None, content = postData["title"]+" successfully added to Bedre Netflix")
|
||||
if editMessage:
|
||||
await message.edit(embed = None, content = postData["title"]+" successfully added to Bedre Netflix")
|
||||
else:
|
||||
await message.channel.send(postData["title"]+" successfully added to Bedre Netflix")
|
||||
|
||||
self.bot.log("Added "+postData["title"]+" to Bedre Netflix")
|
||||
elif r.status_code == 400:
|
||||
text = f"{postData['title']} is either already on Bedre Netflix, downloading, or not available"
|
||||
await message.edit(embed = None, content = text)
|
||||
if editMessage:
|
||||
await message.edit(embed = None, content = text)
|
||||
else:
|
||||
await message.channel.send(text)
|
||||
else:
|
||||
await message.edit(embed = None, content = "Something went wrong")
|
||||
if editMessage:
|
||||
await message.edit(embed = None, content = "Something went wrong")
|
||||
else:
|
||||
await message.channel.send("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,6 +157,10 @@ class BedreNetflix():
|
||||
|
||||
await message.add_reaction("❌")
|
||||
|
||||
message = await ctx.channel.fetch_message(message.id)
|
||||
if message.content != "" and not isinstance(ctx.channel, discord.DMChannel):
|
||||
await message.clear_reactions()
|
||||
|
||||
#Adds the requested show to Bedre Netflix
|
||||
async def addShow(self, message, imdbName):
|
||||
if imdbName == None:
|
||||
|
Reference in New Issue
Block a user