Skip to content
This repository was archived by the owner on Jan 10, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/cdc.code-snippets
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"body": [
" @command(name=\"${1:name}\")",
" async def ${1:name}_command(self, ctx):",
" await ctx.reply(f\"${1:message}\")"
" await ctx.send(f\"${1:message}\")"
],
"description": "Create Discord Command"
}
Expand Down
24 changes: 12 additions & 12 deletions lib/NOT IN USE/jumpscare.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ async def jumpscare_command(self, ctx, *, target: Member):
embed.set_image(
url="https://i.pinimg.com/originals/6d/f2/56/6df256a505c2c0851f0a906c00d7da93.gif"
)
await ctx.reply(f"{target.mention} lol")
await ctx.reply(embed=embed)
await ctx.send(f"{target.mention} lol")
await ctx.send(embed=embed)

elif jumpscare == 2:
embed = Embed(
Expand All @@ -42,8 +42,8 @@ async def jumpscare_command(self, ctx, *, target: Member):
embed.set_image(
url="https://i.pinimg.com/originals/ac/fd/40/acfd400be3e5a65503464e395e75947e.gif"
)
await ctx.reply(f"{target.mention} lol")
await ctx.reply(embed=embed)
await ctx.send(f"{target.mention} lol")
await ctx.send(embed=embed)

elif jumpscare == 3:
embed = Embed(
Expand All @@ -57,8 +57,8 @@ async def jumpscare_command(self, ctx, *, target: Member):
embed.set_image(
url="https://static.wikia.nocookie.net/fnafapedia/images/e/e4/Fnaf4_jumpscare_chicaindoorway.gif/revision/latest/top-crop/width/220/height/220?cb=20151031010318"
)
await ctx.reply(f"{target.mention} lol")
await ctx.reply(embed=embed)
await ctx.send(f"{target.mention} lol")
await ctx.send(embed=embed)

elif jumpscare == 4:
embed = Embed(
Expand All @@ -72,8 +72,8 @@ async def jumpscare_command(self, ctx, *, target: Member):
embed.set_image(
url="https://thumbs.gfycat.com/PertinentSevereKrill-max-1mb.gif"
)
await ctx.reply(f"{target.mention} lol")
await ctx.reply(embed=embed)
await ctx.send(f"{target.mention} lol")
await ctx.send(embed=embed)

elif jumpscare == 5:
embed = Embed(
Expand All @@ -85,8 +85,8 @@ async def jumpscare_command(self, ctx, *, target: Member):
text=f"{target.display_name} boo", icon_url=target.avatar_url
)
embed.set_image(url="https://i.makeagif.com/media/7-08-2016/RuqUem.gif")
await ctx.reply(f"{target.mention} lol")
await ctx.reply(embed=embed)
await ctx.send(f"{target.mention} lol")
await ctx.send(embed=embed)

else:
embed = Embed(
Expand All @@ -100,8 +100,8 @@ async def jumpscare_command(self, ctx, *, target: Member):
embed.set_image(
url="https://thumbs.gfycat.com/ShamelessVainCrossbill-max-1mb.gif"
)
await ctx.reply(f"{target.mention} lol")
await ctx.reply(embed=embed)
await ctx.send(f"{target.mention} lol")
await ctx.send(embed=embed)

@Cog.listener()
async def on_ready(self):
Expand Down
12 changes: 6 additions & 6 deletions lib/NOT IN USE/osu.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ async def osu_command(self, ctx, username: Optional[str]):
db.record("SELECT osuUsername FROM users WHERE UserID = ?", ctx.author.id)[
0
]
== None
is None
):
await ctx.reply(
await ctx.send(
f"Your osu! username is set to None\nSet it to your username by doing `{prefix[0]}setosu`"
)
return
Expand Down Expand Up @@ -101,7 +101,7 @@ async def osu_command(self, ctx, username: Optional[str]):

embed.set_thumbnail(url=f"https://a.ppy.sh/{user.user_id}")

await ctx.reply(embed=embed)
await ctx.send(embed=embed)

@command(
name="setosu",
Expand All @@ -110,7 +110,7 @@ async def osu_command(self, ctx, username: Optional[str]):
)
@cooldown(1, 5, BucketType.user)
async def osu_set_command(self, ctx, username: Optional[str]):
if username != None:
if username is not None:
api = OsuApi(os.environ.get("osu_api"))
user = await api.get_user(user=username, mode=0, type_str="string")

Expand All @@ -129,7 +129,7 @@ async def osu_set_command(self, ctx, username: Optional[str]):
)
db.commit()

await ctx.reply(embed=embed)
await ctx.send(embed=embed)

else:
username = db.record(
Expand All @@ -146,7 +146,7 @@ async def osu_set_command(self, ctx, username: Optional[str]):

embed.set_thumbnail(url=f"https://a.ppy.sh/{user.user_id}")

await ctx.reply(embed=embed)
await ctx.send(embed=embed)

@Cog.listener()
async def on_ready(self):
Expand Down
14 changes: 7 additions & 7 deletions lib/bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ async def process_commands(self, message):
await self.invoke(ctx)

else:
await ctx.reply(
await ctx.send(
"Please wait, Doob hasn't fully started up yet <a:loadingdoob:755141175840866364>",
delete_after=10,
)
Expand All @@ -136,31 +136,31 @@ async def on_error(self, err, *args, **kwargs):
# Basic error handling for Doob
async def on_command_error(self, ctx, exc):
# if any([isinstance(exc, error) for error in IGNORE_EXCEPTIONS]):
# await ctx.reply(
# await ctx.send(
# f"Something went wrong!\n\nError: {exc.original}", delete_after=10
# )

if isinstance(exc, MissingRequiredArgument):
await ctx.reply("Required arguments missing.", delete_after=10)
await ctx.send("Required arguments missing.", delete_after=10)

elif isinstance(exc, CommandOnCooldown):
await ctx.reply(
await ctx.send(
f'That command is on a {str(exc.cooldown.type).split(".")[-1]} cooldown! Try again in {exc.retry_after:,.2f} seconds.',
delete_after=exc.retry_after,
)

elif isinstance(exc, MissingPermissions):
await ctx.reply("You don't have permissions for that.", delete_after=10)
await ctx.send("You don't have permissions for that.", delete_after=10)

elif isinstance(exc, EmojiNotFound):
await ctx.reply(
await ctx.send(
"This emote could not be found. This is likely because Doob isn't in the same server as this emote.",
delete_after=10,
)

elif hasattr(exc, "original"):
if isinstance(exc.original, Forbidden):
await ctx.reply(
await ctx.send(
"Doob doesn't have permissions to do that.", delete_after=10
)

Expand Down
8 changes: 4 additions & 4 deletions lib/cogs/bio.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async def discord_bio_command(self, ctx, *, target: Optional[Member]):
desc = f"https://dsc.bio/{data['details']['slug']}" # Sets the description for the embed

if (
data["details"]["premium"] == True
data["details"]["premium"] is True
): # If they are a premium subscriber to Discord.bio
title = f"{target.display_name}'s discord.bio profile 💎" # Give them this title/description
desc = f"💎 https://dsc.bio/{data['details']['slug']} 💎"
Expand Down Expand Up @@ -76,13 +76,13 @@ async def discord_bio_command(self, ctx, *, target: Optional[Member]):
embed.set_thumbnail(url=target.avatar_url)

# If they have a banner on Discord.bio, show it as the "image" in the embed.
if data["details"]["banner"] != None:
if data["details"]["banner"] is not None:
embed.set_image(url=data["details"]["banner"])

await ctx.reply(embed=embed)
await ctx.send(embed=embed)

else: # If the API status is something other then a 200, it sends you a message telling you which status it sent
await ctx.reply(f"Discord.bio API returned a {response.status} status.")
await ctx.send(f"Discord.bio API returned a {response.status} status.")

@Cog.listener()
async def on_ready(self):
Expand Down
37 changes: 30 additions & 7 deletions lib/cogs/exp.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ async def process_xp(self, message):
"SELECT XP, Level, XPLock FROM users WHERE UserID = ?", message.author.id
)
xp_g, lvl_g, xplock_g = db.record(
f"SELECT XP, Level, XPLock FROM guildexp WHERE UserID = {message.author.id} AND GuildID = {message.guild.id}"
"SELECT XP, Level, XPLock FROM guildexp WHERE UserID = ? AND GuildID = ?",
message.author.id,
message.guild.id,
)

if datetime.utcnow() > datetime.fromisoformat(xplock):
Expand Down Expand Up @@ -141,10 +143,12 @@ async def add_gxp(self, message, xp, lvl):
new_lvl = int(((xp + xp_to_add) // 42) ** 0.55)

db.execute(
f"UPDATE guildexp SET XP = XP + ?, Level = ?, XPLock = ? WHERE UserID = {message.author.id} AND GuildID = {message.guild.id}",
f"UPDATE guildexp SET XP = XP + ?, Level = ?, XPLock = ? WHERE UserID = ? AND GuildID = ?",
xp_to_add,
new_lvl,
(datetime.utcnow() + timedelta(seconds=50)).isoformat(),
message.author.id,
message.guild.id,
)
db.commit()

Expand Down Expand Up @@ -180,12 +184,31 @@ async def display_level(self, ctx, target: Optional[Member]):

if lvl is not None:
to_next_level = int((lvl + 1) ** (20 / 11) * 42) - xp
await ctx.reply(
f"`Global Rank:`\n{target.display_name} is level {lvl:,} with {xp:,} xp ({to_next_level:,} xp to next level) and is rank {ids.index(target.id)+1:,} of {len(ids):,} users globally.\n`Server Rank:`\n{target.display_name} is server level {lvl_g:,} with {xp_g:,} server xp and is server rank {ids_g.index(target.id)+1:,} of {len(ids_g):,}."
embed = Embed(
title=f"{target.display_name} is level {lvl:,}",
description=f"XP: {xp:,}\nXP to next level {to_next_level:,}"
+ f"\n\nServer XP: {xp_g:,}\nServer level: {lvl_g:,}",
colour=ctx.author.color,
)

fields = [
("Global Rank:", f"{ids.index(target.id)+1:,} of {len(ids):,}", False),
(
f"Server Rank:",
f"{ids_g.index(target.id)+1:,} of {len(ids_g):,}",
False,
),
]

for field in fields:
embed.add_field(name=field[0], value=field[1], inline=field[2])

embed.set_thumbnail(url=target.avatar_url)

await ctx.send(embed=embed)

else:
ctx.reply("That member is not in the XP Database.")
ctx.send("That member is not in the XP Database.")

@command(
name="levelmessages",
Expand All @@ -212,10 +235,10 @@ async def set_level_messages(self, ctx, *, yes_or_no: Optional[str]):
ctx.guild.id,
)
db.commit()
await ctx.reply(f"Level messages set to `{yes_or_no}`.")
await ctx.send(f"Level messages set to `{yes_or_no}`.")

else:
await ctx.reply(
await ctx.send(
f"The current setting for Level Messages is: `{levelmessages[0][0]}`\nTo change it, type `{prefix[0][0]}levelmessages (yes or no)`"
)

Expand Down
Loading