From b0cfb69d184ac29d1c83ecf0b17dc85d512439c6 Mon Sep 17 00:00:00 2001 From: Kartik OP <85619363+IndianDevInc@users.noreply.github.com> Date: Sun, 16 Jan 2022 11:19:28 +0530 Subject: [PATCH 1/6] Create LICENSE --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index fccbfbe..1981e55 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021 Team-IC +Copyright (c) 2022 genbot Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From b33700f838c084be46580607cae5d01e3af4f0f4 Mon Sep 17 00:00:00 2001 From: Kartik OP <85619363+IndianDevInc@users.noreply.github.com> Date: Sun, 16 Jan 2022 11:20:32 +0530 Subject: [PATCH 2/6] Delete main.py --- main.py | 85 --------------------------------------------------------- 1 file changed, 85 deletions(-) delete mode 100644 main.py diff --git a/main.py b/main.py deleted file mode 100644 index 3af3042..0000000 --- a/main.py +++ /dev/null @@ -1,85 +0,0 @@ -import discord -from discord.ext import commands -import os -import requests -import datetime - -prefix = ["!"] -intents = discord.Intents.default() -intents.members = True -bot = commands.Bot(command_prefix=prefix, intents=intents) - -bypass_id = [887274088249323560] - -@bot.event -async def on_ready(): - print("Logged in as {} (ID: {})!".format(bot.user.name, bot.user.id)) - -def convert(seconds): - seconds = seconds % (24 * 3600) - hour = seconds // 3600 - seconds %= 3600 - minutes = seconds // 60 - seconds %= 60 - - return "%d hour(s), %02d minute(s) and %02d second(s)" % (hour, minutes, seconds) - -@bot.command(brief='Generate Minecraft account.', description='Use this command to generate Minecraft account and send to your DM.') -@commands.cooldown(1, 60*60*12, commands.BucketType.user) -async def gen(ctx): - id = ctx.author.id - member = bot.get_user(id) - try: - channel = await member.create_dm() - - url = requests.get("https://gen.teamic.me/api/generate.php?type=Minecraft") - data_get = url.text - - account = data_get.split(":") - email = account[0] - password = account[1] - - embed = discord.Embed( - title = 'Generated Account', - description = f'Email: {email}\nPassword: {password}', - timestamp=datetime.datetime.utcnow(), - colour = discord.Colour.blue() - ) - - send = discord.Embed( - title = 'Done', - description = 'I have send you an account in DM.', - timestamp=datetime.datetime.utcnow(), - colour = discord.Colour.blue() - ) - - await channel.send(embed=embed) - await ctx.send(embed=send) - - if ctx.author.id in bypass_id: - gen.reset_cooldown(ctx) - - except: - embed = discord.Embed( - title = 'Error', - description = 'uhh! Enable DM so I can send you!', - timestamp=datetime.datetime.utcnow(), - colour = discord.Colour.red() - ) - - await ctx.send(embed=embed) - gen.reset_cooldown(ctx) - -@gen.error -async def gen_error(ctx, error): - if isinstance(error, commands.CommandOnCooldown): - time_left = int(error.retry_after) - embed = discord.Embed( - title=f":warning: Error!", - description=f"You need to wait for {convert(time_left)} to continue use this command!", - color=discord.Colour.red() - ) - await ctx.send(embed=embed) - -TOKEN = os.environ["TOKEN"] -bot.run(TOKEN) From 2ab9c8fc4e4669a2c9f9fed618b4635e5a2de872 Mon Sep 17 00:00:00 2001 From: Kartik OP <85619363+IndianDevInc@users.noreply.github.com> Date: Sun, 16 Jan 2022 11:20:59 +0530 Subject: [PATCH 3/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0c8ed6b..66e11c3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ # GENBOT A discord that Gen the minecraft acc using Team IC API -# This bot is made in PY till Now +# This Gen bot in js From 6301f51d1afbdf570d1381a0cf2fd0509cd00830 Mon Sep 17 00:00:00 2001 From: Kartik OP <85619363+IndianDevInc@users.noreply.github.com> Date: Sun, 16 Jan 2022 11:33:46 +0530 Subject: [PATCH 4/6] Create index.js --- index.js | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 index.js diff --git a/index.js b/index.js new file mode 100644 index 0000000..266ef66 --- /dev/null +++ b/index.js @@ -0,0 +1,76 @@ +// To create a bot we'll need this module +const Discord = require('discord.js'); +// To get the account from Team-IC's API we'll be using request +const request = require('request'); +// Prefix so people don't trigger the command from every message +const prefix = ["!"];//You can change this prefix if you want + +// Creating a way for us to login using the bot +const client = new Discord.Client({ + disableEveryone: true, + allowedMentions: { + parse: [ ], + repliedUser: true, + }, + partials: ['MESSAGE', 'CHANNEL', 'REACTION'], + intents: [ + Discord.Intents.FLAGS.GUILDS, + Discord.Intents.FLAGS.GUILD_MEMBERS, + Discord.Intents.FLAGS.GUILD_MESSAGES, + Discord.Intents.FLAGS.DIRECT_MESSAGES, + ] +}); + +// Event that gets triggered when we are connected to discord using our bot +client.once('ready', () => { + console.log(`Logged in as : ${client.user.tag}`) +}); + +// Event that we will use to know if someone triggers the command +client.on('messageCreate', msg => { + // Stops the event if the author of the command is a bot + if(msg.author.bot) return; + + // Check if the message starts with '{prefix}gen' and removing case sensitivity + if(msg.content.toLowerCase().startsWith(`${prefix}gen`)) { + // Accessing Team-IC's API to generate a Minecraft account + request("https://gen.teamic.me/api/generate.php?type=Minecraft", function (error, response, body) { + // Checking if we got any errors while accessing Team-IC's API + if(error) { + return console.error(error) + } + // Getting the data from Team-IC's API + let content = body; + // Splitting the data + let data = content.split(":"); + // Storing email and password separately + let [ email , password , username ] = data; + // Creating an embed to store Minecraft account details + let embed = new Discord.MessageEmbed() + .setTitle("Generated Account") + .setDescription(`Username: ||${username}||\nEmail: ||${email}||\nPassword: ||${password}||`) + .setColor("BLUE") + .setTimestamp(); + // Creating an embed to send a success message + let send = new Discord.MessageEmbed() + .setTitle("Done") + .setDescription("I have send you an account in DM.") + .setColor("BLUE") + .setTimestamp(); + // Creating an embed if the user doesn't have DM open + let err = new Discord.MessageEmbed() + .setTitle("Error") + .setDescription("uhh! Enable DM so I can send you!") + .setColor("BLUE") + .setTimestamp(); + // Sending the Minecraft account details in the user's dm + msg.author.send({ embeds : [embed] }) + .catch(() => {return msg.reply(err)});// Sending error embed as user's DM not open + // Sending success message + msg.reply({ embeds : [send] }); + }); + } +}); + +// Logging in to our bot's account +client.login(process.env.TOKEN); From 007a14ff411206c72f128941d1bd3e6cf7c344e6 Mon Sep 17 00:00:00 2001 From: Kartik OP <85619363+IndianDevInc@users.noreply.github.com> Date: Sun, 16 Jan 2022 11:35:42 +0530 Subject: [PATCH 5/6] Update README.md --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 66e11c3..8d4db26 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,9 @@ A discord that Gen the minecraft acc using Team IC API # This Gen bot in js + +Thanks to my Team IC Developer Name +He help me to make in js +Name :- + 1. *Kartik OP*#4791 + 2.『ΣO』ᖇEᗩᒪITY#0317 From 67daa338ea182ed0c6931f4c188ac47850fc943d Mon Sep 17 00:00:00 2001 From: Kartik OP <85619363+IndianDevInc@users.noreply.github.com> Date: Sun, 16 Jan 2022 11:35:58 +0530 Subject: [PATCH 6/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8d4db26..80553f9 100644 --- a/README.md +++ b/README.md @@ -6,5 +6,5 @@ A discord that Gen the minecraft acc using Team IC API Thanks to my Team IC Developer Name He help me to make in js Name :- - 1. *Kartik OP*#4791 + 1. * Kartik OP*#4791 2.『ΣO』ᖇEᗩᒪITY#0317