Implement to Discord bots!


Hi there! my name is Icy! i am a web developer who has passion for creating roblox games! In todays tutorial, we will be learning how to implement into discord bots in python!

Getting started

first things first we need to install into our library. I the terminal, Type the following…

# installing and upgrade pip
$ python -m pip install --upgrade pip

# Installing the Module
$ pip install git+

After we install our module we need to install, type in the following in our terminal…

# installing discord
$ pip install git+

Programming our bot

Ok! so now that we have ur modules installed. We can now program our bot.

Step 1

We need our variables so we can program our bot! type in the following…

import discord
import bloxy
import json
import asyncio
from discord.ext import commands

client = discord.Client()
bloxyclient = bloxy.Client()
group = bloxy.Group()
bot = commands.Bot(command_prefix="!")

Step 2

Ok so now we have our variables. Now we can start programming our bot.
Type in the following…

async def on_ready():
   print("Bot is online")

async def balance(ctx):
	await open_account(

	user =

	users = await bank_data()

	bank = users[str(]["bank"]

	em = discord.Embed(title = f"{}'s balance", color =
	em.add_field(name = "Coins", value = bank)
	await ctx.send(embed = em)

async def open_account(user):
	users = await bank_data()

	if str( in users:
		return False
		users[str(] = {}
		users[str(]["bank"] = 0

	with open("bank.json", "w") as f:
		json.dump(users, f)
	return True

async def bank_data():
	with open("bank.json", "r") as f:
		users = json.load(f)

	return users

async def update_bank(user, change = 0, mode = 'bank'):
	users = await bank_data()

	users[str(][mode] += change

	with open("bank.json", "w") as f:
		json.dump(users, f)

	bal = users[str(]["bank"]
	return bal

async def collect(ctx, userid = None)
   if userid:
      await open_account(

	user =

	users = await bank_data()

	earnings = 1000

	await ctx.send(f"You got {earnings} coins!")

	users[str(]["bank"] += earnings

	with open("bank.json", "w") as f:
		json.dump(users, f)

async def main(UserId):
   user = bloxyclient.get_user_by_id(UserId)
   group = bloxyclient.get_group(1234567) -- your group id
   usergroup = bloxyclient.user_is_in_group(group, user)

    if usergroup:
       print("Either user or group does not exist")

Step 3

now that we have all our code done. We can run the code and test the code. but before we need to type in the following…"TOKEN HERE")

Step 4

well now were done! Wait, where not quite done yet we need to make our json file. in whatever studio your using. create a file named “bank.json” and type in these very simple brackets.




Congrats! you made your first discord bot with! Hope this tutorial help you alot.

Link to here
Link to wiki: wiki

Thanks for reading! :slightly_smiling_face: