-
Notifications
You must be signed in to change notification settings - Fork 0
/
invite.py
39 lines (30 loc) · 2.08 KB
/
invite.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import discord
import asyncio
import aiohttp
import pystyle
from pystyle import Colors, Colorate
intents = discord.Intents.all()
print(Colorate.Horizontal(Colors.purple_to_blue, """
██████╗ ██████╗ ████████╗ ██╗███╗ ██╗██╗ ██╗██╗████████╗███████╗
██╔══██╗██╔═══██╗╚══██╔══╝ ██║████╗ ██║██║ ██║██║╚══██╔══╝██╔════╝
██████╔╝██║ ██║ ██║ ██║██╔██╗ ██║██║ ██║██║ ██║ █████╗
██╔══██╗██║ ██║ ██║ ██║██║╚██╗██║╚██╗ ██╔╝██║ ██║ ██╔══╝
██████╔╝╚██████╔╝ ██║ ██║██║ ╚████║ ╚████╔╝ ██║ ██║ ███████╗
╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═══╝ ╚═╝ ╚═╝ ╚══════╝
"""))
async def create_bot_invite(token):
client = discord.Client(intents=intents)
try:
await asyncio.shield(client.login(token))
print(Colorate.Horizontal(Colors.purple_to_blue, f"Bot successfully connected : {client.user.name}"))
invite_url = discord.utils.oauth_url(client.user.id)
print(Colorate.Horizontal(Colors.purple_to_blue, f"""Invitation for the bot :
{invite_url}
"""))
except discord.errors.LoginFailure:
print(Colorate.Horizontal(Colors.purple_to_blue, "Error during the connection, check bot's token."))
await client.close()
async def main():
token = input(Colorate.Horizontal(Colors.purple_to_blue, "Input bot's token : "))
await create_bot_invite(token)
asyncio.run(main())