* prevent from trying to delete `t/add` commands in DMs
This commit is contained in:
Tim Wilson 2020-09-25 12:30:11 -06:00 committed by GitHub
parent dd5ca474a0
commit 6f2c47ee8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

5
bot.py
View File

@ -1225,12 +1225,15 @@ async def add(message, content = ""):
logger.warning("Exception when checking for private status of added torrent(s): {}".format(e))
asyncio.sleep(0.2)
if len(privateTransfers) > 0 or CONFIG['dryrun']:
footerStr = "🔐One or more added torrents are using a private tracker, which may prohibit running the same transfer from multiple locations. Ensure that you're not breaking any private tracker rules."
if len(privateTransfers) > 0 and CONFIG['delete_command_message_private_torrent']:
if message.author.dm_channel is None or message.channel.id != message.author.dm_channel.id:
try:
await message.delete()
footerStr += "\n(I erased the command message to prevent any unintentional sharing of torrent files)"
except Exception as e:
logger.warning("Exception when removing command message used to add private torrent(s): {}".format(e))
embeds[-1].set_footer(text="\n🔐  One or more added torrents are using a private tracker, which may prohibit running the same transfer from multiple locations. Ensure that you're not breaking any private tracker rules.{}".format('' if CONFIG['dryrun'] else "\n(I erased the command message to prevent any unintentional sharing of torrent files)"))
embeds[-1].set_footer(text=footerStr)
for e in embeds:
await message.channel.send(embed=e)
else: