Compare commits
10 Commits
9d88bcc421
...
73f51b2ba9
Author | SHA1 | Date | |
---|---|---|---|
73f51b2ba9 | |||
![]() |
4123ac5450 | ||
![]() |
6a35544f04 | ||
![]() |
2acd8b1dc7 | ||
![]() |
48a176a84e | ||
![]() |
7ad1996e47 | ||
![]() |
d836395420 | ||
![]() |
ba426c9f6e | ||
![]() |
ceb967eb33 | ||
![]() |
2daff8c73e |
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@
|
|||||||
test.py
|
test.py
|
||||||
/commands/__pycache__
|
/commands/__pycache__
|
||||||
/ext/__pycache__
|
/ext/__pycache__
|
||||||
|
/.vs
|
13
README.md
Normal file
13
README.md
Normal 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
|
@ -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="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="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="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)
|
await interaction.response.send_message(embed=em, ephemeral=True)
|
||||||
elif self.values[0] == "Normal Commands":
|
elif self.values[0] == "Normal Commands":
|
||||||
em1 = discord.Embed(title="Normal Commands", description="Here are all the normal commands", color=interaction.user.color)
|
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="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="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="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="More!", value="Check the bot dashboard for more!", 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)
|
await interaction.response.send_message(embed=em1, ephemeral=True)
|
||||||
|
|
||||||
class SelectView(discord.ui.View):
|
class SelectView(discord.ui.View):
|
||||||
|
59
commands/joinrole.py
Normal file
59
commands/joinrole.py
Normal 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
59
commands/redeem.py
Normal 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))
|
@ -12,8 +12,8 @@ def is_enabled(self):
|
|||||||
db = client.servers
|
db = client.servers
|
||||||
coll = db.settings
|
coll = db.settings
|
||||||
|
|
||||||
if 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":"ticket"}})
|
command = coll.find_one({"_id": {"guild_id": self.guild.id, "commands":"store"}})
|
||||||
command_enabled = command["enabled"] # True or False
|
command_enabled = command["enabled"] # True or False
|
||||||
if command_enabled:
|
if command_enabled:
|
||||||
return True
|
return True
|
||||||
@ -176,7 +176,7 @@ class store(commands.Cog):
|
|||||||
@commands.hybrid_command(name="store", description="View the store")
|
@commands.hybrid_command(name="store", description="View the store")
|
||||||
@commands.check(is_enabled)
|
@commands.check(is_enabled)
|
||||||
async def store(self, ctx):
|
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="Bronze Ticket", value="100 Bloboons", inline=False)
|
||||||
em.add_field(name="Silver Ticket", value="200 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)
|
em.add_field(name="Gold Ticket", value="400 Bloboons", inline=False)
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
aiofiles==23.2.1
|
aiofiles==23.2.1
|
||||||
aiohttp==3.9.0
|
aiohttp==3.9.1
|
||||||
discord.py==2.3.2
|
discord.py==2.3.2
|
||||||
python-dotenv==1.0.0
|
python-dotenv==1.0.0
|
||||||
requests==2.31.0
|
requests==2.31.0
|
||||||
urllib3==2.1.0
|
urllib3==2.1.0
|
||||||
sentry-sdk==1.37.0
|
sentry-sdk==1.39.1
|
||||||
aiosqlite==0.3.0
|
aiosqlite==0.3.0
|
||||||
pymongo==4.6.0
|
pymongo==4.6.1
|
||||||
multidict==6.0.4
|
multidict==6.0.4
|
||||||
|
Loading…
Reference in New Issue
Block a user