Compare commits
5 Commits
0924aac451
...
mors
| Author | SHA1 | Date | |
|---|---|---|---|
| 5ed8002b40 | |||
| c94667ee52 | |||
| 83facc2fb9 | |||
| 5b9c27fcad | |||
| c9431d0c86 |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -174,3 +174,8 @@ cython_debug/
|
|||||||
# PyPI configuration file
|
# PyPI configuration file
|
||||||
.pypirc
|
.pypirc
|
||||||
|
|
||||||
|
/workorder.9tkd
|
||||||
|
|
||||||
|
.vs/
|
||||||
|
|
||||||
|
pyproject.toml
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ As this is my main focus, All the support is welcomed & extremely appreicated! I
|
|||||||
- [Cog-Creators](https://github.com/Cog-Creators)
|
- [Cog-Creators](https://github.com/Cog-Creators)
|
||||||
---
|
---
|
||||||
## License
|
## License
|
||||||
This repository and is cogs are protected under the GPU-3.0 License.
|
This repository and is cogs are protected under the GPL-3.0 License.
|
||||||
For Further information visit [GPC-30 License](https://git.kitsunic.org/kitsunicWorks/unstable-cogs/src/branch/main/LICENSE)
|
For Further information visit [GPL-30 License](https://git.kitsunic.org/kitsunicWorks/unstable-cogs/src/branch/main/LICENSE)
|
||||||
|
|
||||||
Copyright (C) 2025-present kitsunicWorks unstable-cog
|
Copyright (C) 2025-present kitsunicWorks unstable-cog
|
||||||
4
kbump/__init__.py
Normal file
4
kbump/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
from .kbump import kBump
|
||||||
|
|
||||||
|
async def setup(bot):
|
||||||
|
await bot.add_cog(kBump(bot))
|
||||||
8
kbump/info.json
Normal file
8
kbump/info.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"author": ["kitsunicWorks"],
|
||||||
|
"name": "kBump",
|
||||||
|
"short": "A bridge to the kBump database.",
|
||||||
|
"description": "Allows this Red bot to read and interact with data from the separate kBump services.",
|
||||||
|
"requirements": ["pymongo"],
|
||||||
|
"tags": ["utility", "database", "bridge"]
|
||||||
|
}
|
||||||
104
kbump/kbump.py
Normal file
104
kbump/kbump.py
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
import discord
|
||||||
|
import pymongo
|
||||||
|
from redbot.core import checks, commands
|
||||||
|
from redbot.core.bot import Red
|
||||||
|
|
||||||
|
class kBump(commands.Cog):
|
||||||
|
"""
|
||||||
|
A bridge to the kBump MongoDB database.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, bot: Red):
|
||||||
|
self.bot = bot
|
||||||
|
self.client = None
|
||||||
|
self.servers_collection = None
|
||||||
|
# Create a background task to connect to the DB after the bot is ready
|
||||||
|
self.db_init_task = self.bot.loop.create_task(self.initialize_db())
|
||||||
|
|
||||||
|
async def initialize_db(self):
|
||||||
|
"""Initializes the database connection."""
|
||||||
|
await self.bot.wait_until_ready()
|
||||||
|
try:
|
||||||
|
# Retrieve the secure URI we set with the '[p]set api' command
|
||||||
|
uri = (await self.bot.get_shared_api_tokens("mongodb")).get("uri")
|
||||||
|
if not uri:
|
||||||
|
print("[kBump] MongoDB URI not set! Use '[p]set api mongodb uri ...' to set it.")
|
||||||
|
return
|
||||||
|
self.client = pymongo.MongoClient(uri)
|
||||||
|
# Connect to the same database and collection as your other bot
|
||||||
|
db = self.client["BytesBump"]
|
||||||
|
self.servers_collection = db["servers"]
|
||||||
|
print("[kBump] Successfully connected to the BytesBump MongoDB.")
|
||||||
|
except pymongo.errors.PyMongoError as e:
|
||||||
|
print(f"[kBump] PyMongo error connecting to BytesBump MongoDB: {e}")
|
||||||
|
return
|
||||||
|
except Exception as e:
|
||||||
|
print(f"[kBump] General error connecting to BytesBump MongoDB: {e}")
|
||||||
|
|
||||||
|
def cog_unload(self):
|
||||||
|
"""Close the client connection when the cog is unloaded."""
|
||||||
|
if self.client:
|
||||||
|
try:
|
||||||
|
self.client.close()
|
||||||
|
print("[kBump] Closed connection to the BytesBump MongoDB.")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"[kBump] Error closing connection to the BytesBump MongoDB: {e}")
|
||||||
|
# Cancel the background task
|
||||||
|
self.db_init_task.cancel()
|
||||||
|
|
||||||
|
@commands.command()
|
||||||
|
@commands.guild_only()
|
||||||
|
@checks.mod_or_permissions(manage_guild=True)
|
||||||
|
async def bumpstatus(self, ctx: commands.Context, guild: discord.Guild = None):
|
||||||
|
"""
|
||||||
|
Checks the kBump setup status for a server.
|
||||||
|
If no server is provided, it checks the current server.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
if not self.servers_collection:
|
||||||
|
await ctx.send("Database connection is not available. Please check the console logs.")
|
||||||
|
return
|
||||||
|
if not self.servers_collection:
|
||||||
|
await ctx.send("The kBump database connection is not yet initialized. Please wait for the initialization task to complete.")
|
||||||
|
return
|
||||||
|
target_guild = guild or ctx.guild
|
||||||
|
server_data = self.servers_collection.find_one({"_id": target_guild.id})
|
||||||
|
if not server_data:
|
||||||
|
await ctx.send(f"No kBump data found for the server: `{target_guild.name}`.")
|
||||||
|
return
|
||||||
|
# Rest of the code remains the same
|
||||||
|
except pymongo.errors.PyMongoError as e:
|
||||||
|
print(f"[kBump] PyMongo error getting kBump data for server: {e}")
|
||||||
|
await ctx.send(f"Error getting kBump data for the server: `{target_guild.name}`. Please check the console logs for more information.")
|
||||||
|
return
|
||||||
|
except Exception as e:
|
||||||
|
print(f"[kBump] General error getting kBump data for server: {e}")
|
||||||
|
await ctx.send(f"Error getting kBump data for the server: `{target_guild.name}`. Please check the console logs for more information.")
|
||||||
|
return
|
||||||
|
|
||||||
|
embed_color = discord.Color(server_data.get('color', 0x2F3136))
|
||||||
|
embed = discord.Embed(
|
||||||
|
title=f"kBump Status for {target_guild.name}",
|
||||||
|
color=embed_color
|
||||||
|
)
|
||||||
|
embed.set_thumbnail(url=target_guild.icon.url if target_guild.icon else None)
|
||||||
|
|
||||||
|
description = server_data.get('description', 'Not set.')
|
||||||
|
embed.add_field(name="📝 Description", value=f"```{description[:1000]}```", inline=False)
|
||||||
|
|
||||||
|
custom_tags = server_data.get('tags', 'Not set.')
|
||||||
|
embed.add_field(name="🏷️ Custom Tags", value=custom_tags, inline=False)
|
||||||
|
|
||||||
|
discovery_tags = server_data.get('discovery_tags')
|
||||||
|
if discovery_tags:
|
||||||
|
embed.add_field(name="🌐 Official Discovery Tags", value=discovery_tags, inline=False)
|
||||||
|
|
||||||
|
vanity = server_data.get('vanity_code')
|
||||||
|
if vanity:
|
||||||
|
embed.add_field(name="🔗 Vanity URL", value=f"`discord.gg/{vanity}`", inline=True)
|
||||||
|
|
||||||
|
invite = server_data.get('invite_code')
|
||||||
|
if invite:
|
||||||
|
embed.add_field(name="✉️ Invite Code", value=f"`{invite}`", inline=True)
|
||||||
|
|
||||||
|
await ctx.send(embed=embed)
|
||||||
0
kofi-shop/README.md
Normal file
0
kofi-shop/README.md
Normal file
0
kofi-shop/__init__.py
Normal file
0
kofi-shop/__init__.py
Normal file
16
kofi-shop/info.json
Normal file
16
kofi-shop/info.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"author": [ "unstableCogs" ],
|
||||||
|
"install_msg": "Thank you for installing the Ko-fi Shop cog! Use `[p]help KofiShop` for commands.",
|
||||||
|
"name": "KofiShop",
|
||||||
|
"short": "An interactive front-end for a Ko-fi store.",
|
||||||
|
"description": "Allows users to place orders and submit reviews for items available on the client's Ko-fi store. This cog acts as a bridge to an external shop.",
|
||||||
|
"tags": [
|
||||||
|
"kofi",
|
||||||
|
"shop",
|
||||||
|
"store",
|
||||||
|
"review",
|
||||||
|
"utility"
|
||||||
|
],
|
||||||
|
"requirements": [ "rich" ],
|
||||||
|
"end_user_data_statement": "This cog persistently stores user IDs, order details, and submitted reviews to manage shop history and transactions."
|
||||||
|
}
|
||||||
0
kofi-shop/kofi-shop.py
Normal file
0
kofi-shop/kofi-shop.py
Normal file
0
modmail/README.md
Normal file
0
modmail/README.md
Normal file
0
modmail/__init__.py
Normal file
0
modmail/__init__.py
Normal file
16
modmail/info.json
Normal file
16
modmail/info.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"author": [ "unstableCogs" ],
|
||||||
|
"install_msg": "Thank you for installing the ModMail cog! Please use `[p]help ModMail` for setup commands.",
|
||||||
|
"name": "ModMail",
|
||||||
|
"short": "A private, forum-based ModMail system.",
|
||||||
|
"description": "A comprehensive ModMail system that relays user DMs to a private forum channel for staff to review and respond to. This serves as the core for all ticket-based interactions.",
|
||||||
|
"tags": [
|
||||||
|
"modmail",
|
||||||
|
"moderation",
|
||||||
|
"support",
|
||||||
|
"tickets",
|
||||||
|
"utility"
|
||||||
|
],
|
||||||
|
"requirements": [ "rich" ],
|
||||||
|
"end_user_data_statement": "This cog persistently stores user IDs and message content from ModMail threads for moderation and support history."
|
||||||
|
}
|
||||||
0
modmail/modmail.py
Normal file
0
modmail/modmail.py
Normal file
0
mors/README.md
Normal file
0
mors/README.md
Normal file
0
mors/__init__.py
Normal file
0
mors/__init__.py
Normal file
16
mors/info.json
Normal file
16
mors/info.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"author": [ "unstableCogs" ],
|
||||||
|
"install_msg": "Thank you for installing the Mass Outreach & Review System! For a full command list, please see the wiki.",
|
||||||
|
"name": "MassOutreach",
|
||||||
|
"short": "A multi-step system for mass outreach and reviews.",
|
||||||
|
"description": "Manages a complete workflow for user outreach. The process begins with /game, uses /over for time selection, and concludes with a /pudding-head command for the user to submit a mass review.",
|
||||||
|
"tags": [
|
||||||
|
"mass",
|
||||||
|
"outreach",
|
||||||
|
"review",
|
||||||
|
"tickets",
|
||||||
|
"utility"
|
||||||
|
],
|
||||||
|
"requirements": [ "rich" ],
|
||||||
|
"end_user_data_statement": "This cog stores user IDs and ticket information temporarily for the duration of the outreach process. Submitted reviews are stored persistently."
|
||||||
|
}
|
||||||
0
mors/mors.py
Normal file
0
mors/mors.py
Normal file
Reference in New Issue
Block a user