Compare commits

..

No commits in common. "73f51b2ba996f5a7ea9341dd3b30f4ff6248642c" and "9d88bcc421cb2ca19113b8565b33dcf6654230af" have entirely different histories.

9 changed files with 9 additions and 140 deletions

1
.gitignore vendored
View File

@ -3,4 +3,3 @@
test.py
/commands/__pycache__
/ext/__pycache__
/.vs

View File

@ -1,13 +0,0 @@
## Blob
Blob is a discord bot written primarily in Python. I created this bot for fun back in November 2022. I have since long discontinued the use of this bot.
## Upcoming Changes
Some changes I might get around to at some point is adding a web dashboard for the bot.
I also would like to implement more features and update a few commands.
I would like to switch all commands to slash commands.
## How to run your own version of Blob
TBD

View File

@ -32,7 +32,6 @@ class Select(discord.ui.Select):
em.add_field(name="unlock", value="Unlocks a channel, Example: -unlock", inline=False)
em.add_field(name="trash", value="Delete a ticket, Example: -trash", inline=False)
em.add_field(name="remove", value="Removes a role from a user, Example: -remove @Tropiiツ @Owner", inline=False)
em.add_field(name="joinrole", value="Set the role a user gets on join, Example: -joinrole @Member", inline=False)
await interaction.response.send_message(embed=em, ephemeral=True)
elif self.values[0] == "Normal Commands":
em1 = discord.Embed(title="Normal Commands", description="Here are all the normal commands", color=interaction.user.color)
@ -60,7 +59,9 @@ class Select(discord.ui.Select):
em1.add_field(name="work", value="Work for money, Example: -work", inline=False)
em1.add_field(name="balance", value="Check your balance, Example: -balance", inline=False)
em1.add_field(name="pay", value="Pay someone money, Example: -pay @Tropiiツ 100", inline=False)
em1.add_field(name="More!", value="Check the bot dashboard for more!", inline=False)
em1.add_field(name="leaderboard", value="See the leaderboard, Example: -leaderboard", inline=False)
em1.add_field(name="slots", value="Play slots, Example: -slots", inline=False)
em1.add_field(name="rob", value="Rob someone, Example: -rob @Tropiiツ", inline=False)
await interaction.response.send_message(embed=em1, ephemeral=True)
class SelectView(discord.ui.View):

View File

@ -1,59 +0,0 @@
import discord, pymongo, os
from discord.ext import commands
from dotenv import load_dotenv
load_dotenv()
def is_enabled(self):
client = pymongo.MongoClient(os.getenv("mongo_url"))
db = client.servers
coll = db.settings
if coll.find_one({"_id": {"guild_id": self.guild.id, "commands":"joinrole"}}):
command = coll.find_one({"_id": {"guild_id": self.guild.id, "commands":"joinrole"}})
command_enabled = command["enabled"] # True or False
if command_enabled:
return True
else:
return False
else:
return True
class joinrole(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_ready(self):
print("Joinrole Online")
@commands.hybrid_command(name="joinrole", description="Set the joinrole")
@commands.check(is_enabled)
@commands.has_permissions(manage_roles=True)
async def joinrole(self, ctx, role:discord.Role):
client = pymongo.MongoClient(os.getenv("mongo_url"))
db = client.servers
coll = db.roles
roles = coll.find_one({"_id": {"guild_id": ctx.guild.id}})
if not roles:
coll.insert_one({"_id": {"guild_id": ctx.guild.id}, "joinrole": role.id})
await ctx.send(f"Set the joinrole to {role.mention}!")
return
else:
coll.update_one({"_id": {"guild_id": ctx.guild.id}}, {"$set": {"joinrole": role.id}})
await ctx.send(f"Set the joinrole to {role.mention}!")
@commands.Cog.listener()
async def on_member_join(self, member):
client = pymongo.MongoClient(os.getenv("mongo_url"))
db = client.servers
coll = db.roles
joinrole = coll.find_one({"_id": {"guild_id": member.guild.id}})
if joinrole:
role = member.guild.get_role(joinrole["joinrole"])
await member.add_roles(role)
async def setup(bot):
await bot.add_cog(joinrole(bot))

View File

@ -1,59 +0,0 @@
import discord, pymongo, os
from discord.ext import commands
from dotenv import load_dotenv
load_dotenv()
def is_enabled(self):
client = pymongo.MongoClient(os.getenv("mongo_url"))
db = client.servers
coll = db.settings
if coll.find_one({"_id": {"guild_id": self.guild.id, "commands":"redeem"}}):
command = coll.find_one({"_id": {"guild_id": self.guild.id, "commands":"redeem"}})
command_enabled = command["enabled"] # True or False
if command_enabled:
return True
else:
return False
else:
return True
class redeem(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_ready(self):
print("Redeem Online")
@commands.hybrid_command(name="redeem", description="Redeem a ticket")
@commands.check(is_enabled)
async def redeem(self, ctx, ticket_type: str):
client = pymongo.MongoClient(os.getenv("mongo_url"))
db = client.servers
coll = db.economy
guild = ctx.guild
user = ctx.author
userColl = coll.find_one({"_id": {'author_id': user.id, 'guild_id': guild.id}})
if not userColl:
await ctx.send("You don't have any coins!")
return
if not userColl["bought"]:
await ctx.send("You don't have any tickets!")
return
if ticket_type == userColl["bought"]:
coll.update_one({"_id": {"author_id": user.id, "guild_id": guild.id}}, {"$set": {"bought": None}})
await ctx.send("You redeemed your ticket!")
return
else:
await ctx.send("You don't have that ticket!")
return
async def setup(bot):
await bot.add_cog(redeem(bot))

View File

@ -12,8 +12,8 @@ def is_enabled(self):
db = client.servers
coll = db.settings
if coll.find_one({"_id": {"guild_id": self.guild.id, "commands":"store"}}):
command = coll.find_one({"_id": {"guild_id": self.guild.id, "commands":"store"}})
if coll.find_one({"_id": {"guild_id": self.guild.id, "commands":"ticket"}}):
command = coll.find_one({"_id": {"guild_id": self.guild.id, "commands":"ticket"}})
command_enabled = command["enabled"] # True or False
if command_enabled:
return True
@ -176,7 +176,7 @@ class store(commands.Cog):
@commands.hybrid_command(name="store", description="View the store")
@commands.check(is_enabled)
async def store(self, ctx):
em = discord.Embed(title="Shop!", description="Spend some Bloboons to get cool rewards! Redeem in supported servers! Currently has no use", color=ctx.author.color)
em = discord.Embed(title="Shop!", description="Spend some Bloboons to get cool rewards! Redeem in supported servers!", color=ctx.author.color)
em.add_field(name="Bronze Ticket", value="100 Bloboons", inline=False)
em.add_field(name="Silver Ticket", value="200 Bloboons", inline=False)
em.add_field(name="Gold Ticket", value="400 Bloboons", inline=False)

View File

@ -1,10 +1,10 @@
aiofiles==23.2.1
aiohttp==3.9.1
aiohttp==3.9.0
discord.py==2.3.2
python-dotenv==1.0.0
requests==2.31.0
urllib3==2.1.0
sentry-sdk==1.39.1
sentry-sdk==1.37.0
aiosqlite==0.3.0
pymongo==4.6.1
pymongo==4.6.0
multidict==6.0.4