~nova/fletcher

ref: c1acd163f33f54a9b253f908f8387cb0c0a07fa7 fletcher/utils/letthemin.py -rw-r--r-- 1011 bytes
c1acd163 — Novalinium muple 5 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import configparser
import discord
import os
import sys

FLETCHER_CONFIG = os.getenv('FLETCHER_CONFIG', './.fletcherrc')

config = configparser.ConfigParser()
config.read(FLETCHER_CONFIG)

client = discord.Client()

# token from https://discordapp.com/developers
token = config['discord']['botToken']

@client.event
async def on_ready():
    message = await client.get_guild(sys.argv.get(1, 630487117688078358)).get_channel(sys.argv.get(2, 631197469497360415)).fetch_message(sys.argv.get(3, 717173524925644870))
    target_channel = message.guild.get_channel(sys.argv.get(4, 717170421979676712))
    for reaction in message.reactions:
        async for user in reaction.users():
            if user.id in [336572756705673226, 429368441577930753, 382984420321263617] or target_channel.permissions_for(user).read_messages:
                pass
            else:
                print(user)
                await target_channel.set_permissions(user, read_messages=True)

    await client.close()
client.run(token)