Skip to content

Commit

Permalink
HUGE update
Browse files Browse the repository at this point in the history
  • Loading branch information
nosnowowie93347 committed Jun 10, 2022
1 parent 6ac4ffa commit 9ef7ba4
Show file tree
Hide file tree
Showing 118 changed files with 7,984 additions and 9,720 deletions.
603 changes: 358 additions & 245 deletions Admin.py

Large diffs are not rendered by default.

525 changes: 287 additions & 238 deletions Botstuff.py

Large diffs are not rendered by default.

516 changes: 288 additions & 228 deletions Fun.py

Large diffs are not rendered by default.

170 changes: 81 additions & 89 deletions Help.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,99 +4,91 @@

# These color constants are taken from discord.js library
colors = {
'DEFAULT': 0x000000,
'WHITE': 0xFFFFFF,
'AQUA': 0x1ABC9C,
'GREEN': 0x2ECC71,
'BLUE': 0x3498DB,
'PURPLE': 0x9B59B6,
'LUMINOUS_VIVID_PINK': 0xE91E63,
'GOLD': 0xF1C40F,
'ORANGE': 0xE67E22,
'RED': 0xE74C3C,
'GREY': 0x95A5A6,
'NAVY': 0x34495E,
'DARK_AQUA': 0x11806A,
'DARK_GREEN': 0x1F8B4C,
'DARK_BLUE': 0x206694,
'DARK_PURPLE': 0x71368A,
'DARK_VIVID_PINK': 0xAD1457,
'DARK_GOLD': 0xC27C0E,
'DARK_ORANGE': 0xA84300,
'DARK_RED': 0x992D22,
'DARK_GREY': 0x979C9F,
'DARKER_GREY': 0x7F8C8D,
'LIGHT_GREY': 0xBCC0C0,
'DARK_NAVY': 0x2C3E50,
'BLURPLE': 0x7289DA,
'GREYPLE': 0x99AAB5,
'DARK_BUT_NOT_BLACK': 0x2C2F33,
'NOT_QUITE_BLACK': 0x23272A
"DEFAULT": 0x000000,
"WHITE": 0xFFFFFF,
"AQUA": 0x1ABC9C,
"GREEN": 0x2ECC71,
"BLUE": 0x3498DB,
"PURPLE": 0x9B59B6,
"LUMINOUS_VIVID_PINK": 0xE91E63,
"GOLD": 0xF1C40F,
"ORANGE": 0xE67E22,
"RED": 0xE74C3C,
"GREY": 0x95A5A6,
"NAVY": 0x34495E,
"DARK_AQUA": 0x11806A,
"DARK_GREEN": 0x1F8B4C,
"DARK_BLUE": 0x206694,
"DARK_PURPLE": 0x71368A,
"DARK_VIVID_PINK": 0xAD1457,
"DARK_GOLD": 0xC27C0E,
"DARK_ORANGE": 0xA84300,
"DARK_RED": 0x992D22,
"DARK_GREY": 0x979C9F,
"DARKER_GREY": 0x7F8C8D,
"LIGHT_GREY": 0xBCC0C0,
"DARK_NAVY": 0x2C3E50,
"BLURPLE": 0x7289DA,
"GREYPLE": 0x99AAB5,
"DARK_BUT_NOT_BLACK": 0x2C2F33,
"NOT_QUITE_BLACK": 0x23272A,
}


class Embed(commands.Cog):
def __init__(self, bot):
self.bot = bot

@commands.command(
name="embed", description="The embed command", help="create an embed"
)
async def embed_command(self, ctx):

# Define a check function that validates the message received by the bot
def check(ms):
# Look for the message sent in the same channel where the command was used
# As well as by the user who used the command.
return ms.channel == ctx.message.channel and ms.author == ctx.message.author

# First ask the user for the title
await ctx.send(content="What would you like the title to be?")

# Wait for a response and get the title
msg = await self.bot.wait_for("message", check=check)
title = msg.content # Set the title

# Next, ask for the content
await ctx.send(content="What would you like the Description to be?")
msg = await self.bot.wait_for("message", check=check)
desc = msg.content

# Finally make the embed and send it
msg = await ctx.send(content="Now generating the embed...")

color_list = [c for c in colors.values()]
# Convert the colors into a list
# To be able to use random.choice on it

embed = discord.Embed(
title=title, description=desc, color=random.choice(color_list)
)
# Also set the thumbnail to be the bot's pfp
embed.set_thumbnail(url=self.bot.user.avatar_url)

# Also set the embed author to the command user
embed.set_author(
name=ctx.message.author.name, icon_url=ctx.message.author.avatar_url
)

await msg.edit(embed=embed, content=None)
# Editing the message
# We have to specify the content to be 'None' here
# Since we don't want it to stay to 'Now generating embed...'

return

def __init__(self, bot):
self.bot = bot

@commands.command(
name='embed',
description='The embed command',
help="create an embed"
)
async def embed_command(self, ctx):

# Define a check function that validates the message received by the bot
def check(ms):
# Look for the message sent in the same channel where the command was used
# As well as by the user who used the command.
return ms.channel == ctx.message.channel and ms.author == ctx.message.author

# First ask the user for the title
await ctx.send(content='What would you like the title to be?')

# Wait for a response and get the title
msg = await self.bot.wait_for('message', check=check)
title = msg.content # Set the title

# Next, ask for the content
await ctx.send(content='What would you like the Description to be?')
msg = await self.bot.wait_for('message', check=check)
desc = msg.content

# Finally make the embed and send it
msg = await ctx.send(content='Now generating the embed...')

color_list = [c for c in colors.values()]
# Convert the colors into a list
# To be able to use random.choice on it

embed = discord.Embed(
title=title,
description=desc,
color=random.choice(color_list)
)
# Also set the thumbnail to be the bot's pfp
embed.set_thumbnail(url=self.bot.user.avatar_url)

# Also set the embed author to the command user
embed.set_author(
name=ctx.message.author.name,
icon_url=ctx.message.author.avatar_url
)

await msg.edit(
embed=embed,
content=None
)
# Editing the message
# We have to specify the content to be 'None' here
# Since we don't want it to stay to 'Now generating embed...'

return

def setup(bot):
bot.add_cog(Embed(bot))
# Adds the Basic commands to the bot
# Note: The "setup" function has to be there in every cog file
bot.add_cog(Embed(bot))
# Adds the Basic commands to the bot
# Note: The "setup" function has to be there in every cog file
3 changes: 2 additions & 1 deletion Helpme.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

# Requires pip install buttons
from discord.ext import commands
import logging
from utils.util2 import Pag


class HelpMe(commands.Cog, name="Help command"):
def __init__(self, bot):
self.bot = bot
Expand Down Expand Up @@ -73,6 +73,7 @@ async def setup_help_pag(self, ctx, entity=None, title=None):
pages.append(commands_entry)

await Pag(title=title, color=0xCE2029, entries=pages, length=1).start(ctx)

@commands.command(
name="help", aliases=["h", "commands"], description="The help command!"
)
Expand Down
83 changes: 45 additions & 38 deletions Math.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,54 @@
from discord.ext import commands
from discord.ext.commands import Bot, has_permissions


def find_Area(radius):
return math.pi * radius * radius


class Math(commands.Cog):
def __init__(self, bot):
self.bot = bot

@commands.command(description="Adds 2 numbers", usage="<number1> <number2>")
async def add(self, ctx, a: int, b:int):
await ctx.send(a+b)

@commands.command(description="Subtracts 2 numbers", usage="<number1> <number2>")
async def subtract(self, ctx, a: int, b:int):
await ctx.send(a-b)

@commands.command(description="Multiplies 2 numbers", usage="<number1> <number2>")
async def multiply(self, ctx, a: int, b:int):
await ctx.send(a*b)

@commands.command(description="Divides 2 numbers", usage="<number1> <number2>")
async def divide(self, ctx, a: int, b:int):
try:
await ctx.send(a/b)
except ZeroDivisionError as e:
return await ctx.send(e)
@commands.command(description="Square root a number", usage="<number>")
async def sqrt(self, ctx, a: int):
try:
await ctx.send(f"The square root of {a} is {math.sqrt(a)}")
except ValueError as e:
await ctx.send("Only positive #s can be sqrted.")
@commands.command(description="Find the sine of a number", usage="<number>")
async def sin(self, ctx, a: int):
await ctx.send(f"The sine of {a} is {math.sin(a)}")
@commands.command(description="Find the cosine of a number", usage="<number>")
async def cos(self, ctx, a:int):
await ctx.send(f"The cosine of {a} is {math.cos(a)}")
@commands.command(name="circlearea")
async def area_of_circle(self, ctx, *, r: float):
area = find_Area(r)
await ctx.send(" Area Of a Circle with Given Radius = %.2f" %area)
def __init__(self, bot):
self.bot = bot

@commands.command(description="Adds 2 numbers", usage="<number1> <number2>")
async def add(self, ctx, a: int, b: int):
await ctx.send(a + b)

@commands.command(description="Subtracts 2 numbers", usage="<number1> <number2>")
async def subtract(self, ctx, a: int, b: int):
await ctx.send(a - b)

@commands.command(description="Multiplies 2 numbers", usage="<number1> <number2>")
async def multiply(self, ctx, a: int, b: int):
await ctx.send(a * b)

@commands.command(description="Divides 2 numbers", usage="<number1> <number2>")
async def divide(self, ctx, a: int, b: int):
try:
await ctx.send(a / b)
except ZeroDivisionError as e:
return await ctx.send(e)

@commands.command(description="Square root a number", usage="<number>")
async def sqrt(self, ctx, a: int):
try:
await ctx.send(f"The square root of {a} is {math.sqrt(a)}")
except ValueError as e:
await ctx.send("Only positive #s can be sqrted.")

@commands.command(description="Find the sine of a number", usage="<number>")
async def sin(self, ctx, a: int):
await ctx.send(f"The sine of {a} is {math.sin(a)}")

@commands.command(description="Find the cosine of a number", usage="<number>")
async def cos(self, ctx, a: int):
await ctx.send(f"The cosine of {a} is {math.cos(a)}")

@commands.command(name="circlearea")
async def area_of_circle(self, ctx, *, r: float):
area = find_Area(r)
await ctx.send(" Area Of a Circle with Given Radius = %.2f" % area)


def setup(bot):
bot.add_cog(Math(bot))
bot.add_cog(Math(bot))
12 changes: 8 additions & 4 deletions Minifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
from discord.ext.commands import Bot
import python_minifier as minifier


class Minifier(commands.Cog):
"""Minify your code!"""


def __init__(self, bot):
self.bot = bot

@commands.has_permissions(attach_files=True)
@commands.command(usage="<file>")
async def minify(self, ctx):
Expand All @@ -31,11 +31,15 @@ async def minify(self, ctx):
try:
file = await file.read()
except UnicodeDecodeError:
return await ctx.reply("Something went wrong when trying to decode this file.")
return await ctx.reply(
"Something went wrong when trying to decode this file."
)
converted = io.BytesIO(minifier.minify(file).encode(encoding="utf-8"))
return await ctx.send(
content="Please see the attached file below, with your minified code.",
file=discord.File(converted, filename=file_name),
)


def setup(bot):
bot.add_cog(Minifier(bot))
bot.add_cog(Minifier(bot))
Loading

0 comments on commit 9ef7ba4

Please sign in to comment.