I wrote this script for use with the Station 00 Discord server on February 13, 2021
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
dorfl/dorfl.py

26 lines
1.8 KiB

# I wrote this script for use with the Station 00 Discord server on February 13, 2021
# It enables users to create their own channels for which they have full Administrator permissions,
# contrary to the default system, in which only server owners are given the ability to create or
# moderate. The goal of a script like this is to encourage a self-governing community, where rules
# are created by users themselves. If a channel moderator is behaving tyrannically, another person
# can create a competing channel -- it's as close as you can probably get to a free-market democracy.
import discord
import time
g_client = discord.Client()
@g_client.event
async def on_message(message):
if message.author == g_client.user: return
if not(message.content.lower().startswith("dorfl")): return
if not(message.channel.id == 808742739226787874 or message.channel.id == 809881861371330610): return
query = message.content.lower().split(" ")
if len(query) < 3: return
if query[1] == "voice" or query[1] == "text":
for channeli in message.channel.guild.channels:
if channeli.name == query[2]: return
channel = (await message.channel.guild.categories[1].create_voice_channel(query[2])) if query[1] == "voice" else (await message.channel.guild.categories[0].create_text_channel(query[2]))
await channel.set_permissions(message.author, overwrite=discord.PermissionOverwrite.from_pair(discord.Permissions.all_channel(), discord.Permissions.none()))
if query[1] == "text":
await channel.set_permissions(message.channel.guild.default_role, read_messages=False)
await message.channel.send("`created channel " + query[2] + " and gave " + message.author.name + " op`")
g_client.run("INSERT_TOKEN_HERE", bot=True)