Create voice channels from command.

This commit is contained in:
fanyx 2021-05-14 01:10:58 +02:00
parent a2405c62fe
commit 484ce6683c
4 changed files with 45 additions and 2 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
*
!.gitignore
!main.py
!README.md
!requirements.txt
!url.py

View File

@ -1,7 +1,7 @@
# a bot for cinemas
a small bot that facilitates permissions for watch togethers. open a "cinema" via a register command and have people unlock join permissions via reactions to your opening message.
a small bot that facilitates permissions for watch togethers. open a "cinema" via a register command and have people unlock join permissions via reactions to your announcement message.
## configuration
nothing yet.
configuration is done inside the source code. documentation about this will grow with the project.

36
main.py Normal file
View File

@ -0,0 +1,36 @@
from discord.ext import commands
from discord import Permissions, PermissionOverwrite
# init bot
bot = commands.Bot(command_prefix="!")
# init registered cinemas
# subject to change -> save on disk
cinemas = dict()
@bot.group("cinema")
@commands.guild_only()
async def cinema(ctx):
pass
@cinema.command("create")
@commands.bot_has_permissions(manage_channels=True)
async def cinema_create(ctx, name, link=None):
# create permissions overwrites, so noone is allowed to join initially
overwrites = {
ctx.guild.default_role: PermissionOverwrite(connect=False)
}
# create voice channel and register
voice_channel = await ctx.guild.create_voice_channel(name, overwrites=overwrites, category=ctx.channel.category)
cinemas[ctx.message.id] = voice_channel
# create embed for series/movie
# not implemented yet.
# send announcement and create author reaction
announcement = await ctx.channel.send("React to this.")
await announcement.add_reaction("\U0001F3AB")
if __name__ == "__main__":
bot.run('')

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
discord.py>=1.7.2