diff options
author | lexicade <jasonnlelong@gmail.com> | 2023-01-27 21:06:30 +0000 |
---|---|---|
committer | lexicade <jasonnlelong@gmail.com> | 2023-01-27 21:06:30 +0000 |
commit | 52801b4de1d63cd01191acf7fcee137977140ec0 (patch) | |
tree | 08271a1f1e3e8060486b6651c67c9934867c648e /cogs/Screenshare.py | |
parent | 8df873808c86805624851356f5dea76ec621de23 (diff) |
Diffstat (limited to 'cogs/Screenshare.py')
-rw-r--r-- | cogs/Screenshare.py | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/cogs/Screenshare.py b/cogs/Screenshare.py new file mode 100644 index 0000000..6e0d0e6 --- /dev/null +++ b/cogs/Screenshare.py @@ -0,0 +1,62 @@ +from discord.ext import commands +import discord +colours = {"default": 0, + "teal": 0x1abc9c, + "dark teal": 0x11806a, + "green": 0x2ecc71, + "dark green": 0x1f8b4c, + "blue": 0x3498db, + "dark blue": 0x206694, + "purple": 0x9b59b6, + "dark purple": 0x71368a, + "magenta": 0xe91e63, + "dark magenta": 0xad1457, + "gold": 0xf1c40f, + "dark gold": 0xc27c0e, + "orange": 0xe67e22, + "dark orange": 0xa84300, + "red": 0xe74c3c, + "dark red": 0x992d22, + "lighter grey": 0x95a5a6, + "dark grey": 0x607d8b, + "light grey": 0x979c9f, + "darker grey": 0x546e7a, + "blurple": 0x7289da, + "greyple": 0x99aab5} + + +class Screenshare(commands.Cog): + def __init__(self, bot): + self.bot = bot + global extension_name + extension_name = "[Screenshare] " + + @commands.command() + async def screenshare(self, ctx): + """Allows you to start a screenshare from a voice channel.""" + guild_id = ctx.message.channel.guild.id + voice_state = ctx.message.author.voice + + if voice_state is None: + def_embed = discord.Embed(title=f"No voice channel found.", + description=f"Make sure you're in a voice channel before sharing your screen.", + colour=colours["red"]) + await ctx.message.channel.send(embed=def_embed) + + else: + channel_url = f"https://discordapp.com/channels/{guild_id}/{voice_state.channel.id}" + def_embed = discord.Embed(title=f"Screen Share", + description=f"Screenshare in [{voice_state.channel}]({channel_url}) " + + "Be sure to connect to the voice channel first!", + colour=colours["blue"]) + await ctx.message.channel.send(embed=def_embed) + + +def setup(bot): + print("INFO: Loading [Screenshare]... ", end="") + bot.add_cog(Screenshare(bot)) + print("Done!") + + +def teardown(bot): + print("INFO: Unloading [Screenshare]") |