Fsoky

DISCORD Bot | Смотрим ютуб, играем в покер вместе!

Aug 17th, 2021
2,027
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.21 KB | None | 0 0
  1. import json
  2. import requests
  3. import discord
  4. from discord.ext import commands
  5.  
  6. bot = commands.Bot(command_prefix=".", intents=discord.Intents.all())
  7.  
  8.  
  9. @bot.event
  10. async def on_ready():
  11.     print("Bot connected")
  12.  
  13.  
  14. @bot.command()
  15. async def join(ctx):
  16.     """target_application_id
  17.  
  18.         Youtube Together - 755600276941176913
  19.         Betrayal.io - 773336526917861400
  20.         Fishington.io - 814288819477020702
  21.         Poker Night - 755827207812677713
  22.         Chess - 832012774040141894
  23.  
  24.     """
  25.  
  26.     data = {
  27.         "max_age": 86400,
  28.         "max_uses": 0,
  29.         "target_application_id": 755600276941176913, # YouTube Together
  30.         "target_type": 2,
  31.         "temporary": False,
  32.         "validate": None
  33.     }
  34.     headers = {
  35.         "Authorization": "Bot token",
  36.         "Content-Type": "application/json"
  37.     }
  38.  
  39.     if ctx.author.voice is not None:
  40.         if ctx.author.voice.channel is not None:
  41.             channel = ctx.author.voice.channel.id
  42.         else:
  43.             await ctx.send("Зайдите в канал")
  44.     else:
  45.         await ctx.send("Зайдите в канал")
  46.  
  47.     response = requests.post(f"https://discord.com/api/v8/channels/{channel}/invites", data=json.dumps(data), headers=headers)
  48.     link = json.loads(response.content)
  49.  
  50.     await ctx.send(f"https://discord.com/invite/{link['code']}")
  51.  
  52. bot.run("token")
Add Comment
Please, Sign In to add comment