· 5 years ago · Sep 08, 2020, 09:46 PM
1# obtain proper libraries for hypixel stats and discord.py
2import discord
3from discord.ext import commands
4import aiohttp
5import asyncpraw
6import random
7
8#initialize discord.py and hypixel api
9client = commands.Bot(command_prefix = ".")
10
11reddit = asyncpraw.Reddit(client_id="nope",
12 client_secret="nope",
13 user_agent="script: Python (by /u/nope)")
14
15
16@client.command()
17async def hystats(ctx,mcuser):
18 async with aiohttp.ClientSession() as cs:
19 async with cs.get(f'https://api.slothpixel.me/api/players/{mcuser}') as r:
20 res = await r.json() # returns dict
21 await ctx.send(res['total_coins'])
22
23
24
25#sends a message to the console when the bot is connected
26@client.event
27async def on_ready():
28 print(f"{client.user} is ready!")
29
30
31#basic ping command
32@client.command(brief = "Tells you the ping in ms", description = "Tells you the time to connect from idiot.exes pc to the discord server (in ms)")
33async def ping(ctx):
34 await ctx.send(f"pong! {round(client.latency * 1000, 4)} ms")
35
36#orchestra website command that mentions the sender
37@client.command(brief = "links the orchestra website", description = "links the orchestra website")
38async def website(ctx):
39 await ctx.send(f"{ctx.author.mention} https://sites.google.com/a/roundrockisd.org/round-rock-high-dragon-orchestra/")
40
41#funny meme command
42@client.command(brief = "haha brrr go brrrr", description = "brrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr")
43async def brr(ctx):
44 await ctx.send("https://i.clouds.tf/hys8/7nvo.png")
45
46#tells you if you have nitro idk why i made this
47@client.command()
48async def nitro(ctx):
49 user = ctx.author
50
51 if user.premium_since == None:
52 await ctx.send("you do not have nitro")
53 else:
54 await ctx.send("you have nitro")
55
56#links the rrdragonorchestra instagram
57@client.command()
58async def instagram(ctx):
59 await ctx.send(f"{ctx.author.mention} https://instagram.com/rrdragonorchestra")
60
61
62#links the skyleamoe page for a given user
63@client.command()
64async def sbprof(ctx,mcname):
65 await ctx.send(f"https://sky.lea.moe/stats/{mcname}")
66
67@client.command()
68async def meme(ctx):
69 memesubs = ["memes","dankmemes"]
70 subreddit = await reddit.subreddit(random.choice(memesubs))
71 submission = await subreddit.random()
72 await ctx.send(submission.url)
73
74
75
76
77@client.command()
78async def basement(ctx):
79 myguild = client.get_guild(733508936216477706)
80
81 basement_role = myguild.get_role(744013188911071362)
82
83 await ctx.author.add_roles(basement_role)
84
85
86
87
88
89#uses my api key to run the code and start sending it over to discord
90client.run("nope")
91