def unfollow(ctx):
f = open('%susers/allusers.txt' % path, 'r+')
all = f.read().strip()
if all:
users = all.split(',')
else:
users = []
if ctx.message.author.id in users:
users.remove(ctx.message.author.id)
f.seek(0)
f.truncate()
if users != ['']:
for i in users:
if i:
f.write(i + ',')
else:
pass
os.remove('%susers/user%s.txt' % (path, ctx.message.author.id))
await bot.send_message(ctx.message.channel, 'You have unsubscribed from the reddit notifier feed. Use ``ap:follow`` to resubscribe if you\'d like. **Note: your list has been deleted** so if you subscribe again, you must remake your list.')
await bot.send_message(discord.Object(id=config["log_location"]), 'User: ' + str(ctx.message.author) + '\nCmd: ' + str(ctx.message.content))
else:
await bot.send_message(ctx.message.channel, 'You are already unsubscribed from the notifier.')
f.close()
评论列表
文章目录