Compare commits

...

10 Commits

Author SHA1 Message Date
73f51b2ba9
Create README.md 2024-10-04 10:35:18 -04:00
TropiiDev
4123ac5450 Merge branch 'main' of https://github.com/TropiiDev/Blob 2023-12-21 11:19:25 -05:00
TropiiDev
6a35544f04 Update help! 2023-12-21 11:19:06 -05:00
TropiiDev
2acd8b1dc7
Update requirements.txt 2023-12-19 18:31:28 -05:00
TropiiDev
48a176a84e Updated help 2023-12-05 19:46:52 -05:00
tropii
7ad1996e47 Added Events 2023-11-27 21:45:29 -05:00
tropii
d836395420 Updated help 2023-11-25 10:00:17 -05:00
tropii
ba426c9f6e Updated JoinRole 2023-11-25 09:58:05 -05:00
tropii
ceb967eb33 JoinRole 2023-11-25 09:49:20 -05:00
tropii
2daff8c73e Redeem 2023-11-24 23:49:11 -05:00
9 changed files with 140 additions and 9 deletions

1
.gitignore vendored
View File

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

13
README.md Normal file
View File

@ -0,0 +1,13 @@
## 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,6 +32,7 @@ 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)
@ -59,9 +60,7 @@ 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="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)
em1.add_field(name="More!", value="Check the bot dashboard for more!", inline=False)
await interaction.response.send_message(embed=em1, ephemeral=True)
class SelectView(discord.ui.View):

59
commands/joinrole.py Normal file
View File

@ -0,0 +1,59 @@
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))

59
commands/redeem.py Normal file
View File

@ -0,0 +1,59 @@
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":"ticket"}}):
command = coll.find_one({"_id": {"guild_id": self.guild.id, "commands":"ticket"}})
if coll.find_one({"_id": {"guild_id": self.guild.id, "commands":"store"}}):
command = coll.find_one({"_id": {"guild_id": self.guild.id, "commands":"store"}})
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!", color=ctx.author.color)
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.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.0
aiohttp==3.9.1
discord.py==2.3.2
python-dotenv==1.0.0
requests==2.31.0
urllib3==2.1.0
sentry-sdk==1.37.0
sentry-sdk==1.39.1
aiosqlite==0.3.0
pymongo==4.6.0
pymongo==4.6.1
multidict==6.0.4