mirror of
https://github.com/NohamR/TransmissionBot.git
synced 2025-05-24 00:48:59 +00:00
bugfix
* prevent from trying to delete `t/add` commands in DMs
This commit is contained in:
parent
dd5ca474a0
commit
6f2c47ee8f
5
bot.py
5
bot.py
@ -1225,12 +1225,15 @@ async def add(message, content = ""):
|
|||||||
logger.warning("Exception when checking for private status of added torrent(s): {}".format(e))
|
logger.warning("Exception when checking for private status of added torrent(s): {}".format(e))
|
||||||
asyncio.sleep(0.2)
|
asyncio.sleep(0.2)
|
||||||
if len(privateTransfers) > 0 or CONFIG['dryrun']:
|
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 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:
|
try:
|
||||||
await message.delete()
|
await message.delete()
|
||||||
|
footerStr += "\n(I erased the command message to prevent any unintentional sharing of torrent files)"
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning("Exception when removing command message used to add private torrent(s): {}".format(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:
|
for e in embeds:
|
||||||
await message.channel.send(embed=e)
|
await message.channel.send(embed=e)
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user