import discord
from discord.ext import commands, tasks
from datetime import datetime, timedelta
bot = commands.Bot(command_prefix='.', intents=discord.Intents.all())
mention_count = {}
reset_time = datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)
statuses = [".gg/curemarket"]
slot_configs = {"pings": {"@here": 0, "@everyone": 0}}
PINGS_RESET_CHANNEL_ID = 1260927186219827231
SLOT_OWNER_ROLE_ID = 1256166878502719509
CATEGORY_1_ID = 1190250041265369088
CATEGORY_2_ID = 1258391337376677959
CATEGORY_3_ID = 1259457387891523604
@tasks.loop(seconds=5) # Change status every 5 seconds
async def change_status():
new_status = statuses.pop(0) # Get the first status
statuses.append(new_status) # Move the current status to the end of the list
await
bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching,
name=new_status))
@bot.event
async def on_ready():
print(f'We Have Connected As {bot.user}')
print('- G R A B A ')
reset_mentions.start()
change_status.start()
update_timer.start()
@tasks.loop(seconds=60) # Check every minute
async def reset_mentions():
global mention_count, reset_time
now = datetime.now()
if now > reset_time:
mention_count = {}
reset_time = now + timedelta(days=1)
channel = bot.get_channel(PINGS_RESET_CHANNEL_ID)
if channel:
await channel.send("Nukes have been reseted!\nPings have been
reseted!")
@tasks.loop(seconds=60) # Update timer every minute
async def update_timer():
now = datetime.now()
time_left = reset_time - now
hours_left = time_left.seconds // 3600
minutes_left = (time_left.seconds % 3600) // 60
channel = bot.get_channel(PINGS_RESET_CHANNEL_ID)
if channel:
await channel.edit(topic=f"Pings reset in {hours_left} hours and
{minutes_left} minutes")
@bot.command()
async def time_left(ctx):
now = datetime.now()
time_left = reset_time - now
hours_left = time_left.seconds // 3600
minutes_left = (time_left.seconds % 3600) // 60
await ctx.send(f"Pings reset in {hours_left} hours and {minutes_left} minutes")
@bot.event
async def on_message(message):
if message.author.bot:
return
global mention_count
# Check if the message contains a mention of @here or @everyone
if ("@here" in message.content or "@everyone" in message.content) and
message.channel.category_id == 1259457387891523604:
ping_type = "@here" if "@here" in message.content else "@everyone"
if slot_configs["pings"][ping_type] == 0:
embed = discord.Embed(
description=f"**{message.author.mention}, Your Slot Has been
Revoked for Using Wrong Ping ({ping_type}).**",
color=0xFF7C2D)
await message.channel.send(embed=embed)
await message.channel.set_permissions(message.author,
send_messages=False)
await remove_slot_owner_role(message.author)
return
mention_count["overall"] = mention_count.get("overall", 0) + 1
mention_count[message.author.id] = mention_count.get(message.author.id, 0)
+ 1
embed = discord.Embed(
description=f'**{message.author.mention}, YOU USED**
__**{mention_count[message.author.id]}/{slot_configs["pings"][ping_type]}**__
**PINGS**. | __**USE MM TO BE SAFE!**__',
color=0xFF7C2D)
na = await message.channel.send(embed=embed)
if mention_count[message.author.id] > slot_configs["pings"][ping_type]:
# Remove send message permission from the channel and send a
notification
await message.channel.set_permissions(message.author,
send_messages=False)
embed = discord.Embed(
description=f"**{message.author.mention}, Your Slot Has been
Revoked for Using {mention_count[message.author.id]}x {ping_type} Pings.**",
color=0xFF7C2D)
await na.delete()
await message.channel.send(embed=embed)
await remove_slot_owner_role(message.author)
await bot.process_commands(message)
async def add_slot_owner_role(user):
role = discord.utils.get(user.guild.roles, id=SLOT_OWNER_ROLE_ID)
if role:
await user.add_roles(role)
async def remove_slot_owner_role(user):
role = discord.utils.get(user.guild.roles, id=SLOT_OWNER_ROLE_ID)
if role:
await user.remove_roles(role)
@bot.command()
@commands.has_permissions(administrator=True)
async def slot(ctx, user: discord.Member, slot_name: str, ping_type: int,
ping_limit: int, duration: str = '1w', category_id: int = CATEGORY_3_ID):
global mention_count
category_obj = discord.utils.get(ctx.guild.categories, id=category_id)
if not category_obj:
await ctx.send("Invalid category ID. Please provide a valid category ID.")
return
channel = await category_obj.create_text_channel(slot_name)
# Set default permissions
await channel.set_permissions(ctx.guild.default_role,
view_channel=True,
send_messages=False)
await channel.set_permissions(user,
view_channel=True,
send_messages=True,
mention_everyone=True)
# Parse duration and calculate expiry date
if duration.endswith('w'):
duration_days = int(duration[:-1]) * 7
duration_text = f"{int(duration[:-1])} weeks"
elif duration.endswith('m'):
duration_days = int(duration[:-1]) * 30
duration_text = f"{int(duration[:-1])} months"
else:
duration_days = int(duration)
duration_text = f"{duration_days} days"
purchase_date = datetime.utcnow()
expiry_date = purchase_date + timedelta(days=duration_days)
# Set ping type and limit
if ping_type == 1:
slot_configs["pings"]["@here"] = ping_limit
slot_configs["pings"]["@everyone"] = 0
elif ping_type == 2:
slot_configs["pings"]["@here"] = 0
slot_configs["pings"]["@everyone"] = ping_limit
# Reset mention count for the user
mention_count[user.id] = 0
# Add slot owner role
await add_slot_owner_role(user)
# Create slot details embed
embed = discord.Embed(
title="Slot Channel Created",
description=f"Slot channel for {user.mention} has been created.",
color=discord.Color.green()
)
await ctx.send(embed=embed)
embed2 = discord.Embed(
title="CUREMARKET SLOT RULES",
description="""**
➥ No role ping.
➥ No Refund on private slot.
➥ You can't sell your slot.
➥ You can't share your slot.
➥ Any Kind of promotion is not allowed.
➥ No advertising Allowed - Only autobuy link !.
➥ If you disobey any of these rules, Slot will be revoked without refund.
Scam = Slot revoke Without refund**
""",
color=0xFF7C2D)
await channel.send(embed=embed2)
# Create slot details embed with ping info
ping_info = f"{ping_limit}x @here" if ping_type == 1 else f"{ping_limit}x
@everyone"
embed3 = discord.Embed(
title="CUREMARKET Slot Details",
description=f"**Purchase Date:** {purchase_date.strftime('%d-%m')}\n"
f"**Duration:** **{duration_days} days | {duration_text}**\n"
f"**Expiry Date:** {expiry_date.strftime('%d-%m')}\n"
f"**Permissions:** {ping_info}",
color=discord.Color.green()
)
embed3.add_field(name="Rule 1",
value="**Must** follow the slot rules strictly.",
inline=False)
embed3.add_field(name="Rule 2",
value="**Must** Always accept MM.",
inline=False)
await channel.send(embed=embed3)
@bot.command()
@commands.has_permissions(administrator=True)
async def revoke(ctx, user: discord.User, channel: discord.TextChannel = None):
channel = channel or ctx.channel
# Remove send message permission
await channel.set_permissions(user, send_messages=False)
# Remove slot owner role
await remove_slot_owner_role(user)
embed = discord.Embed(
title="Slot Revoked",
description=f"The slot for {user.mention} has been revoked.",
color=discord.Color.red()
)
await ctx.send(embed=embed)
@bot.command()
@commands.has_permissions(administrator=True)
async def unrevoke(ctx, user: discord.User, channel: discord.TextChannel = None):
channel = channel or ctx.channel
# Restore send message permission
await channel.set_permissions(user, send_messages=True)
# Add slot owner role
await add_slot_owner_role(user)
embed = discord.Embed(
title="Slot Unrevoked",
description=f"The slot for {user.mention} has been unrevoked.",
color=discord.Color.green()
)
await ctx.send(embed=embed)
@bot.command()
@commands.has_permissions(administrator=True)
async def hold(ctx, user: discord.User, channel: discord.TextChannel = None):
channel = channel or ctx.channel
# Remove send message permission
await channel.set_permissions(user, send_messages=False)
# Remove slot owner role
await remove_slot_owner_role(user)
embed = discord.Embed(
title="Slot Held",
description=f"The slot for {user.mention} has been held.",
color=discord.Color.red()
)
await ctx.send(embed=embed)
@bot.command()
@commands.has_permissions(administrator=True)
async def unhold(ctx, user: discord.User, channel: discord.TextChannel = None):
channel = channel or ctx.channel
# Restore send message permission
await channel.set_permissions(user, send_messages=True)
# Add slot owner role
await add_slot_owner_role(user)
embed = discord.Embed(
title="Slot Unheld",
description=f"The slot for {user.mention} has been unheld.",
color=discord.Color.green()
)
await ctx.send(embed=embed)
bot.run('MTI1ODM5MzE4MjkyNDcwMTczNw.GqkDDB.rBRKXJPg4lAHW5n4JOiuaoXMS2AodtwSjujooo')