DISCORD.PY BOT/CODE BASED ON THEALTENING API


Tux
 Share

Recommended Posts

Hello everyone,

Hope you are all doing good and staying safe.

So I decided to release my discord bot based on thealtening API it has the following options: Generate/License/Info, the description of these options can be found here https://panel.thealtening.com/#api

(IF ANYONE WOULD LIKE FAVORITE/PRIVATE ACCOUNTS TELL ME I'LL WORK ON CODING IT!)

How does it work?:

How it works is that the only people who can gen accounts must have the role "MC KID" if the user does so they can use the commands, along with this what you should do is for example make a channel called #bot-commands and type ".help" doing so the bot will dm you the help menu containing all it's commands. (YOU WILL HAVE TO COMPILE THE CODE AND HOST IT YOUR SELF.)(I ALSO RECOMMEND YOU MAKE YOUR BOT "PRIVATE" SO NO ONE CAN STEAL IT AND ADD IT TO THERE SERVER AND GET ACCOUNTS ON YOU!)

How does one install discord,py/requests?

# Linux/macOS
python3 -m pip install -U discord.py

# Windows
py -3 -m pip install -U discord.py

# Windows:

py -m pip install requests

# Linux/Mac Os

python3 -m pip install requests

 

import discord
from discord.ext import commands
from discord import Game
from discord.ext.commands import Bot
import requests
import json
import re

#bot prefix
bot = commands.Bot(command_prefix = '.', case_insensitive=True)

#bot token        
token= ""

#api info
apikey = "" #put your api key here

#discord status
game = discord.Game("YUM ALL THESE ACCOUNTS!")

@bot.event
async def on_ready():
    print('Im ready to gen some accounts')
    await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name=".help"))
    #await bot.change_presence(activity=game) 

#removes standard help command
bot.remove_command('help')

#help command
@bot.command(pass_context=True)
@commands.has_role('MC KID')
async def help(ctx):
    await ctx.message.delete()
    embed=discord.Embed(color=0x00ff00)
    embed.set_author(name="Thealtening Dictonary")
    embed.add_field(name='Main', value='``.generate`` | Generates a token.\n' '``.license`` | Returns information about the API Key.\n' '``.information`` | Checks if token is invalid or valid.\n', inline=False)
    embed.set_thumbnail(url="https://i.imgur.com/Pt0iYQN.png")
    embed.set_footer(text="Gamer Development")
    await ctx.author.send(embed=embed)

#generate
@bot.command()
@commands.has_role('MC KID')
async def generate(ctx):
    await ctx.message.delete()
    r = requests.get(f"http://api.thealtening.com/v2/generate?key={apikey}&info=true")
    r_json = r.json() 
    embed=discord.Embed(title=f"{r_json['username']}", description=f"``Token:`` {r_json['token']}\n``Limit:`` {str(r_json['limit'])}\n", color=0x00ff00)
    embed.set_thumbnail(url=f"https://cdn.thealtening.com/skins/face/{r_json['skin']}.png")
    embed.set_footer(text=f"Requested by {str(ctx.author)}", icon_url=ctx.author.avatar_url)
    try:
        embed.add_field(name="Hypixel Level", value=f"{r_json['info']['hypixel.lvl']}", inline=False)
    except:
        embed.add_field(name="Hypixel Level", value="-", inline=True)
    try:
        embed.add_field(name="Hypixel Rank", value=f"{r_json['info']['hypixel.rank']}", inline=False)
    except:
        embed.add_field(name="Hypixel Rank", value="-", inline=True)
    try:
        embed.add_field(name="Mineplex Level", value=f"{r_json['info']['mineplex.lvl']}", inline=False)
    except:
        embed.add_field(name="Mineplex Level", value="-", inline=True)
    try:
        embed.add_field(name="Mineplex Rank", value=f"{r_json['info']['mineplex.rank']}", inline=False)
    except:
        embed.add_field(name="Mineplex Rank", value="-", inline=True)
    try:
        embed.add_field(name="LabyMod Cape", value=f"{r_json['info']['labymod.cape']}", inline=False)
    except:
        embed.add_field(name="LabyMod Cape", value="-", inline=True)
    try:
        embed.add_field(name="5Zig Cape", value=f"{r_json['info']['5zig.cape']}", inline=False)
    except:
        embed.add_field(name="5Zig Cape", value="-", inline=True)
    await ctx.author.send(embed=embed)

#license
@bot.command()
@commands.has_role('MC KID')
async def license(ctx):
    await ctx.message.delete()
    r = requests.get(f"http://api.thealtening.com/v2/license?key={apikey}")
    r_json = r.json()
    embed=discord.Embed(title=f"Checking Your License", description=f"Username: {r_json['username']}\nHaslicense: {str(r_json['hasLicense'])}\nLicenseType: {r_json['licenseType']}\nExpires: {r_json['expires']}\n", color=0x00ff00)
    embed.set_thumbnail(url="https://i.imgur.com/Pt0iYQN.png")
    embed.set_footer(text=f"Requested by {str(ctx.author)}", icon_url=ctx.author.avatar_url)
    await ctx.author.send(embed=embed)

#information
@bot.command()
@commands.has_role('MC KID')
async def information(ctx, token):
    await ctx.message.delete()
    r = requests.get(f"http://api.thealtening.com/v2/info?key={apikey}&token={token}")
    r_json = r.json()
    embed=discord.Embed(title=f"{r_json['username']}", description=f"Expries: {r_json['expires']}\n", color=0x00ff00)
    embed.set_thumbnail(url=f"https://cdn.thealtening.com/skins/face/{r_json['skin']}.png")
    embed.set_footer(text=f"Requested by {str(ctx.author)}", icon_url=ctx.author.avatar_url)
    await ctx.author.send(embed=embed)

#info (about) command
@bot.command(name='info', aliases=['about'])
@commands.has_role('MC KID')
async def info(ctx):
    await ctx.message.delete()
	#description of the bot
    embed = discord.Embed(title='Thealtening Bot', description='This bot allows you to genearate/check tokens at the Thealtening alts shop.', color=0x00ff00)
	
	#gives info about us here
    embed.add_field(name='Made by', value='Tux - xFueY - Godd')
	
	#Shows the number of servers the bot is in
    embed.add_field(name='Server count', value=f'{len(bot.guilds)}')

	#sends the embed message
    embed.set_footer(text="Gamer Development")
    await ctx.author.send(embed=embed)

#runs the bot   
bot.run(token, bot=True)


 

Edited by Tux

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share