Compare commits
2 Commits
roleplayga
...
8a7621836f
| Author | SHA1 | Date | |
|---|---|---|---|
| 8a7621836f | |||
| eec57c7e23 |
0
servicereview/README.md
Normal file
0
servicereview/README.md
Normal file
0
servicereview/__init__.py
Normal file
0
servicereview/__init__.py
Normal file
15
servicereview/info.json
Normal file
15
servicereview/info.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"author": [ "unstableCogs" ],
|
||||
"install_msg": "Thank you for installing the Service Review cog!",
|
||||
"name": "ServiceReview",
|
||||
"short": "A command for users to leave a service review.",
|
||||
"description": "Allows users to submit a service review at any time, independently of any ticket system. Submissions are sent to a designated channel for staff.",
|
||||
"tags": [
|
||||
"review",
|
||||
"service",
|
||||
"feedback",
|
||||
"utility"
|
||||
],
|
||||
"requirements": [ "rich" ],
|
||||
"end_user_data_statement": "This cog persistently stores the user's ID and the content of their submitted review for record-keeping purposes."
|
||||
}
|
||||
0
servicereview/iservice.py
Normal file
0
servicereview/iservice.py
Normal file
9
welcomer/README.md
Normal file
9
welcomer/README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# Welcomer Cog
|
||||
|
||||
A simple cog to welcome new users to a server with a customizable message.
|
||||
|
||||
**Features:**
|
||||
- Greets new members in a designated channel.
|
||||
- Uses custom formatting provided by the server admin.
|
||||
|
||||
For full documentation, please visit the [repository wiki](https://git.kitsunic.org/kitsunicWorks/unstable-cogs/wiki).
|
||||
0
welcomer/__init__.py
Normal file
0
welcomer/__init__.py
Normal file
14
welcomer/info.json
Normal file
14
welcomer/info.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"author": [ "unstableCogs" ],
|
||||
"install_msg": "Thank you for installing the Welcomer cog!",
|
||||
"name": "Welcomer",
|
||||
"short": "A simple cog to welcome new users.",
|
||||
"description": "Greets new members in a designated channel with a customizable message. This cog is part of the Unified Bot Suite.",
|
||||
"tags": [
|
||||
"welcome",
|
||||
"utility",
|
||||
"greeting"
|
||||
],
|
||||
"requirements": [],
|
||||
"end_user_data_statement": "This cog does not persistently store any end user data."
|
||||
}
|
||||
40
welcomer/welcomer.py
Normal file
40
welcomer/welcomer.py
Normal file
@@ -0,0 +1,40 @@
|
||||
# welcomer.py
|
||||
|
||||
from redbot.core import commands
|
||||
from redbot.core.bot import Red
|
||||
import discord
|
||||
|
||||
class Welcomer(commands.Cog):
|
||||
"""A simple cog to welcome new users."""
|
||||
|
||||
def __init__(self, bot: Red):
|
||||
self.bot = bot
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_member_join(self, member):
|
||||
"""Greets a new member when they join the server."""
|
||||
|
||||
guild = member.guild
|
||||
while True:
|
||||
# Try to find a channel named 'welcome'
|
||||
channel = discord.utils.get(guild.text_channels, name='welcome')
|
||||
if channel is None:
|
||||
# If not found, try to find a channel named 'general'
|
||||
channel = discord.utils.get(guild.text_channels, name='general')
|
||||
if channel is None:
|
||||
# If still not found, use the first text channel available
|
||||
if guild.text_channels:
|
||||
channel = guild.text_channels[0]
|
||||
else:
|
||||
# If no text channels exist, exit the function
|
||||
return
|
||||
try:
|
||||
await channel.send(f"Welcome to the server, {member.mention}!")
|
||||
break # Exit the loop after successfully sending the message
|
||||
except discord.Forbidden:
|
||||
# If we don't have permission to send messages in this channel, try again
|
||||
continue
|
||||
|
||||
# This function allows Red to load the cog
|
||||
async def setup(bot: Red):
|
||||
await bot.add_cog(Welcomer(bot))
|
||||
Reference in New Issue
Block a user