diff --git a/royalpack/__main__.py b/royalpack/__main__.py index b1415ee4..036a5f09 100644 --- a/royalpack/__main__.py +++ b/royalpack/__main__.py @@ -140,6 +140,7 @@ register_discord(ds_router, commands.fiorygi_dig, ["dig"], r"(?P[a-z0-9-]+ register_discord(ds_router, commands.fiorygi_bury, ["bury"], r"(?P[a-z0-9-]+)\s+(?P[0-9]+)(?:\s+(?P.+))?") register_discord(ds_router, commands.version, ["version"]) register_discord(ds_router, commands.rocoinflip, ["rocoinflip"], r'"(?P[^"]+)"\s+"(?P[^"]+)"') +register_discord(ds_router, commands.hack, ["hack"], r'(?P.+)') pda.implementations["telethon.1"].register_conversation(tg_router) pda.implementations["discordpy.2"].register_conversation(ds_router) diff --git a/royalpack/commands/__init__.py b/royalpack/commands/__init__.py index 101493f8..59a7273f 100644 --- a/royalpack/commands/__init__.py +++ b/royalpack/commands/__init__.py @@ -18,3 +18,4 @@ from .fiorygi import * from .version import * from .cv import * from .rocoinflip import * +from .hack import * diff --git a/royalpack/commands/hack.py b/royalpack/commands/hack.py new file mode 100644 index 00000000..3f0c73db --- /dev/null +++ b/royalpack/commands/hack.py @@ -0,0 +1,55 @@ +import royalnet.royaltyping as t +import royalnet.engineer as engi +import royalnet_discordpy +import royalnet_discordpy.bullet.contents +import discord +import discord.http + + +activities = { + "yt": 755600276941176913, + "poker": 755827207812677713, + "amogus": 773336526917861400, + "fishing": 814288819477020702, +} + + +@engi.TeleportingConversation +async def hack(*, _imp: engi.PDAImplementation, _msg: engi.Message, activity: str, **__): + """ + Hack!? + + `yt` - YouTube Together + `amogus` - Betrayal + """ + + if not isinstance(_imp, royalnet_discordpy.DiscordpyPDAImplementation): + await _msg.reply(text="⚠️ Puoi HACKERARE IL PIANETA solo da Discord.") + return + + _user: engi.User = await _msg.sender + user: t.Union[discord.User, discord.Member] = _user._user + + if user.voice is None: + await _msg.reply(text="⚠️ Devi essere in chat vocale per HACKERARE IL PIANETA.") + return + + channel: discord.VoiceChannel = user.voice.channel + data = await channel._state.http.request( + discord.http.Route('POST', '/channels/{channel_id}/invites', channel_id=channel.id), + reason="Test", + json={ + 'max_age': 86400, + 'max_uses': 0, + 'target_application_id': activities[activity], + 'target_type': 2, + 'temporary': False, + 'validate': None + } + ) + invite: discord.Invite = discord.Invite.from_incomplete(data=data, state=channel._state) + + await _msg.reply(text=f"🎞 https://discord.com/invite/{invite.code}") + + +__all__ = ("hack",)