1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-26 21:14:19 +00:00

HACC THE PLANET

This commit is contained in:
Steffo 2021-05-11 04:05:20 +02:00
parent 57f832b320
commit e484d9fb5f
Signed by: steffo
GPG key ID: 6965406171929D01
3 changed files with 57 additions and 0 deletions

View file

@ -140,6 +140,7 @@ register_discord(ds_router, commands.fiorygi_dig, ["dig"], r"(?P<slug>[a-z0-9-]+
register_discord(ds_router, commands.fiorygi_bury, ["bury"], r"(?P<slug>[a-z0-9-]+)\s+(?P<value>[0-9]+)(?:\s+(?P<message>.+))?")
register_discord(ds_router, commands.version, ["version"])
register_discord(ds_router, commands.rocoinflip, ["rocoinflip"], r'"(?P<teama>[^"]+)"\s+"(?P<teamb>[^"]+)"')
register_discord(ds_router, commands.hack, ["hack"], r'(?P<activity>.+)')
pda.implementations["telethon.1"].register_conversation(tg_router)
pda.implementations["discordpy.2"].register_conversation(ds_router)

View file

@ -18,3 +18,4 @@ from .fiorygi import *
from .version import *
from .cv import *
from .rocoinflip import *
from .hack import *

View file

@ -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",)