[DiscordExperiments] Initial commit
This commit is contained in:
@@ -17,6 +17,8 @@ dadjokes - Another UltimatePancake cog. Get some dad jokes on command.
|
||||
|
||||
dictionary - Define words and look up antonyms and synonyms. Originally by UltimatePancake.
|
||||
|
||||
discordexperiments - Create voice channel invites for various built-in apps. This is only for developers or for people that can read the code and assess the risk of using it.
|
||||
|
||||
dungeon - [Depreciated/Unsupported] New users with new accounts will be shuffled off to a locked channel on-join to help mitigate raiders. Please see the [dungeon_readme.md](https://github.com/aikaterna/aikaterna-cogs/blob/v3/dungeon_readme.md) file on this repo for more information.
|
||||
|
||||
embedpeek - Take a closer look at or unpack embed content. This cog is mostly a developer tool.
|
||||
|
||||
5
discordexperiments/__init__.py
Normal file
5
discordexperiments/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from .discordexperiments import DiscordExperiments
|
||||
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(DiscordExperiments(bot))
|
||||
85
discordexperiments/discordexperiments.py
Normal file
85
discordexperiments/discordexperiments.py
Normal file
@@ -0,0 +1,85 @@
|
||||
import discord
|
||||
from discord.http import Route
|
||||
from redbot.core import checks, commands
|
||||
|
||||
|
||||
class DiscordExperiments(commands.Cog):
|
||||
"""Create voice channel invites to access experimental applications on Discord."""
|
||||
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
async def _create_invite(self, ctx, app_id: int, max_age: int, app_name: str):
|
||||
voice = ctx.author.voice
|
||||
if not voice:
|
||||
return await ctx.send("You have to be in a voice channel to use this command.")
|
||||
if not voice.channel.permissions_for(ctx.me).create_instant_invite == True:
|
||||
return await ctx.send(
|
||||
"I need the `Create Invite` permission for your channel before you can use this command."
|
||||
)
|
||||
|
||||
r = Route("POST", "/channels/{channel_id}/invites", channel_id=voice.channel.id)
|
||||
payload = {"max_age": max_age, "target_type": 2, "target_application_id": app_id}
|
||||
code = (await self.bot.http.request(r, json=payload))["code"]
|
||||
|
||||
await ctx.send(
|
||||
embed=discord.Embed(
|
||||
description=f"[Click here to join {app_name} in {voice.channel.name}!](https://discord.gg/{code})",
|
||||
color=0x2F3136,
|
||||
)
|
||||
)
|
||||
|
||||
@commands.cooldown(1, 10, discord.ext.commands.BucketType.guild)
|
||||
@commands.command()
|
||||
async def ytparty(self, ctx, invite_max_age_in_seconds=86400):
|
||||
"""
|
||||
Create a YouTube Together voice channel invite.
|
||||
|
||||
Use `0` for `invite_max_age_in_seconds` if you want the invite to be permanent.
|
||||
"""
|
||||
app_name = "YouTube Together"
|
||||
await self._create_invite(ctx, 755600276941176913, invite_max_age_in_seconds, app_name)
|
||||
|
||||
@commands.cooldown(1, 10, discord.ext.commands.BucketType.guild)
|
||||
@commands.command()
|
||||
async def betrayal(self, ctx, invite_max_age_in_seconds=86400):
|
||||
"""
|
||||
Create a Betrayal.io voice channel invite.
|
||||
|
||||
Use `0` for `invite_max_age_in_seconds` if you want the invite to be permanent.
|
||||
"""
|
||||
app_name = "the Betrayal game"
|
||||
await self._create_invite(ctx, 773336526917861400, invite_max_age_in_seconds, app_name)
|
||||
|
||||
@commands.cooldown(1, 10, discord.ext.commands.BucketType.guild)
|
||||
@commands.command()
|
||||
async def fishington(self, ctx, invite_max_age_in_seconds=86400):
|
||||
"""
|
||||
Create a Fishington.io voice channel invite.
|
||||
|
||||
Use `0` for `invite_max_age_in_seconds` if you want the invite to be permanent.
|
||||
"""
|
||||
app_name = "the Fishington game"
|
||||
await self._create_invite(ctx, 814288819477020702, invite_max_age_in_seconds, app_name)
|
||||
|
||||
@commands.cooldown(1, 10, discord.ext.commands.BucketType.guild)
|
||||
@commands.command()
|
||||
async def pokernight(self, ctx, invite_max_age_in_seconds=86400):
|
||||
"""
|
||||
Create a Discord Poker Night voice channel invite.
|
||||
|
||||
Use `0` for `invite_max_age_in_seconds` if you want the invite to be permanent.
|
||||
"""
|
||||
app_name = "Discord Poker Night"
|
||||
await self._create_invite(ctx, 755827207812677713, invite_max_age_in_seconds, app_name)
|
||||
|
||||
@commands.cooldown(1, 10, discord.ext.commands.BucketType.guild)
|
||||
@commands.command()
|
||||
async def chess(self, ctx, invite_max_age_in_seconds=86400):
|
||||
"""
|
||||
Create a Chess in the Park voice channel invite.
|
||||
|
||||
Use `0` for `invite_max_age_in_seconds` if you want the invite to be permanent.
|
||||
"""
|
||||
app_name = "Chess in the Park"
|
||||
await self._create_invite(ctx, 832012586023256104, invite_max_age_in_seconds, app_name)
|
||||
7
discordexperiments/info.json
Normal file
7
discordexperiments/info.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"author": ["aikaterna"],
|
||||
"install_msg": "⚠ **THIS COG IS NOT FOR GENERAL USE** ⚠\nThis cog creates voice invites for experimental applications that Discord is still working on.\nAnything can break at any time.\nI am not responsible for anything that happens to your Discord account or your bot while using this cog.\nUsers are required to use OAuth authentication to access some of these applications on joining the voice channels and interacting with it. This interaction/authentication is between Discord and the service(s) providing the experiments.\nI do not recommend installing this cog on a public bot.\nDO NOT LOAD THIS COG IF YOU DO NOT AGREE TO THE RISKS. NOT ALL RISKS HAVE BEEN EXPLAINED HERE.",
|
||||
"short": "Create voice invites for experimental Discord applications.",
|
||||
"description": "Create voice invites for experimental Discord applications.",
|
||||
"tags": ["discord"]
|
||||
}
|
||||
Reference in New Issue
Block a user