Package: dcactivity
DCActivityAn unofficial module used to access Discord's Beta features like YouTube, Poker Night, etc. with your BotFeatures•Installation•Usage•Documentation•LicenseFeaturesSuper Easy to use!Supportsdiscord.pyBetter error handling with custom and discord.py's inbuilt Exceptions
Type Hinting and proper Documentationdiscord.pylike Docs making it easy to read the docs for existing discord.py usersSupportsLoggingCurrently Supported Applications are:YouTube Together (youtube)CG 2 DEV (chess)Betrayal.io (betrayal)Poker Night (poker)Fishington.io (fishing)InstallationPython 3.6 or higher is requireddiscord.pyV1.5.0 or higher is requiredTo install the library, simply run the following command in your terminal:# Windows
py -m pip install dcactivity

# Linux/macOS
python3 -m pip install dcactivityUsageTo use the library, you must first import it into your script and create a new instance of theDCActivityclass:fromdiscord.extimportcommandsfromdcactivityimportDCActivitybot=commands.Bot(command_prefix='!')bot.dcactivity=DCActivity(bot)To create the invite link, you need to usecreate_link()function:link=awaitbot.dcactivity.create_link(voice_channel,app_id)voice_channel: The Voice channel you want to create the invite link for. Can be Channel ID or discord.VoiceChannel objectapp_id: The Application ID of the Voice Channel game. For this, you need to follow either of the three steps:ImportDCApplicationfromdcactivity:fromdcactivityimportDCApplicationinvite=awaitbot.dcactivity.create_invite(voice_channel,DCApplication.youtube)# or DCApplication.poker, etc.Directly use Application Name or ID (use ID only if you know the exact ID of an activity):invite=awaitbot.dcactivity.create_invite(voice_channel,'youtube')# or poker, chess, etc.ExamplesBot:# bot.pyfromdiscordimportVoiceChannelfromdiscord.extimportcommandsfromdcactivityimportDCActivity,DCApplicationbot=commands.Bot(command_prefix='!')dcactivity=DCActivity(bot)# or "bot.dcactivity = DCActivity(bot)" to use it as a BotVar@bot.command()asyncdefyoutube(ctx,channel:VoiceChannel):invite=awaitdcactivity.create_invite(channel,DCApplication.youtube)awaitctx.send(invite)bot.run('token')Bot with Cogs:bot:# bot.pyfromdiscordimportVoiceChannelfromdiscord.extimportcommandsfromdcactivityimportDCActivitybot=commands.Bot(command_prefix='!')bot.dcactivity=DCActivity(bot)bot.load_extension('cogs.cog')# Simple Example with Cogbot.load_extension('cogs.cog_advanced')# Advanced Example with Cogbot.run('token')cog (simple):# cog.pyfromdiscordimportVoiceChannelfromdiscord.extimportcommandsfromdcactivityimportDCApplicationclassMyCog(commands.Cog):def__init__(self,bot):self.bot=bot@commands.command()asyncdefyoutube(self,ctx,channel:VoiceChannel):invite=awaitself.bot.dcactivity.create_invite(channel,DCApplication.youtube)awaitctx.send(invite)defsetup(bot):bot.add_cog(MyCog(bot))cog (advanced):# cog_advanced.pyfromtypingimportOptionalfromdiscordimportVoiceChannelfromdiscord.extimportcommandsfromdcactivityimportDCApplicationfromdcactivity.errorsimportInvalidChannelclassMyAdvancedCog(commands.Cog):def__init__(self,bot):self.bot=bot@commands.command()asyncdefcustom_link(self,ctx,channel=None):ifnotchannel:ifnotctx.author.voice:returnawaitctx.send('You need to connect to a voice channel first')ifnotisinstance(ctx.author.voice.channel,VoiceChannel):returnawaitctx.send('This feature is not supported in Stage Channels.')_channel=ctx.author.voice.channelelse:_channel=channelinvite=awaitself.bot.dcactivity.create_invite(_channel,DCApplication.youtube,max_age=0,max_uses=10)awaitctx.send(invite)@custom_link.errorasyncdefcustom_link_error(self,ctx,exc):exc=getattr(exc,'original',exc)ifisinstance(exc,InvalidChannel):awaitctx.send('Invalid Channel given as argument.')defsetup(bot):bot.add_cog(MyAdvancedCog(bot))NoteA minimum ofoneperson needs to click on the invite link to start the Voice Channel Activity.Activityresetswhen everyone exits. Though it can again be joined from the same link but from the starting andnot getting resumed.Games likechess/betrayalmaynot work in Stable Clientfor now. To use them, you need installDiscord PTBorDiscord CanaryClient or use them in the web browser.Play/SpectateButton don't work if no one has already joined the Activity. Though after atleast 1 user joins the Activity (by clicking the link), the buttons works fine for other users.InfoThis package is licensed underMIT License. Any contributions are welcomed.Need to contribute? Just Open aPull Requestwith your changes and some information about your changes.Found a bug or having an issue? Open an Issue atGithub!LinksDocumentation:https://akshuagarwal.github.io/DCActivity/Github:https://github.com/AkshuAgarwal/DCActivity/PyPi:https://pypi.org/project/dcactivity/