Files
main.py
requirements.txt
Code
2 194
main.py
import discord
from discord.ext import commands
import os
import random
import asyncio
from dotenv import load_dotenv
load_dotenv()
intents = discord.Intents.all()
bot = commands.Bot(command_prefix="!", intents=intents)
VOUCH_FORMATS = [
"+rep {target} absolute legend, super helpful 🔥",
"+rep {target} trusted seller, fast and smooth ✅",
"+rep {target} great guy, no issues whatsoever 👍",
"+rep {target} 10/10 would deal with again",
"+rep {target} fast delivery, legit and trusted 💯",
"+rep {target} best on the server no doubt 🙌",
"+rep {target} very professional and easy to work with",
"+rep {target} stood up to his word, reliable af ✔️",
"+rep {target} nothing but good things to say, vouch",
"+rep {target} smooth transaction, highly recommend 🤝",
"+rep {target} goated fr, everybody should vouch this guy",
"+rep {target} super quick and honest, big vouch ❤️",
"+rep {target} handled it perfectly, zero problems",
"+rep {target} real one, been vouched by many for a reason",
"+rep {target} clean deal, would 100% go again 💪",
]
vouch_counts = {}
@bot.event
async def on_ready():
print(f"[FakeVouchBot] Logged in as {bot.user} ({bot.user.id})")
await bot.change_presence(activity=discord.Activity(
type=discord.ActivityType.watching,
name="!fv help"
))
@bot.command(name="fv")
@commands.has_permissions(administrator=True)
async def fake_vouch(ctx, amount: int = None, target: discord.Member = None):
if amount is None:
embed = discord.Embed(
title="📋 FakeVouch Help",
color=0x2b2d31
)
embed.add_field(
name="Commands",
value=(
"`!fv <amount>` — Auto-vouch a random member `<amount>` times\n"
"`!fv <amount> @user` — Auto-vouch a specific member `<amount>` times\n"
"`!fv top` — Show vouch leaderboard\n"
"`!fv clear @user` — Reset a member's vouch count\n"
"`!fv clearall` — Reset all vouch counts"
),
inline=False
)
embed.set_footer(text="Admin only • FakeVouchBot")
await ctx.send(embed=embed)
return
if isinstance(amount, str) and amount.lower() == "top":
await show_leaderboard(ctx)
return
if amount < 1 or amount > 200:
await ctx.send("❌ Amount must be between **1** and **200**.", delete_after=5)
return
members = [
m for m in ctx.guild.members
if not m.bot and m != ctx.author
]
if len(members) < 1:
await ctx.send("❌ Not enough members in the server.", delete_after=5)
return
await ctx.message.delete()
status_embed = discord.Embed(
description=f"⏳ Generating **{amount}** vouches...",
color=0xf0b132
)
status_msg = await ctx.send(embed=status_embed)
for i in range(amount):
voucher = random.choice(members)
if target:
vouch_target = target
else:
remaining = [m for m in members if m != voucher]
if not remaining:
remaining = members
vouch_target = random.choice(remaining)
vouch_text = random.choice(VOUCH_FORMATS).format(target=vouch_target.mention)
webhook = None
for wh in await ctx.channel.webhooks():
if wh.name == "VouchBot":
webhook = wh
break
if webhook is None:
webhook = await ctx.channel.create_webhook(name="VouchBot")
await webhook.send(
content=vouch_text,
username=voucher.display_name,
avatar_url=voucher.display_avatar.url
)
uid = str(vouch_target.id)
vouch_counts[uid] = vouch_counts.get(uid, 0) + 1
delay = random.uniform(0.8, 2.2)
await asyncio.sleep(delay)
await status_msg.delete()
done_embed = discord.Embed(
description=f"✅ Successfully posted **{amount}** vouches.",
color=0x57f287
)
done_embed.set_footer(text="FakeVouchBot")
confirm = await ctx.send(embed=done_embed)
await asyncio.sleep(4)
await confirm.delete()
@bot.command(name="fvtop")
@commands.has_permissions(administrator=True)
async def fvtop(ctx):
await show_leaderboard(ctx)
async def show_leaderboard(ctx):
if not vouch_counts:
await ctx.send("📭 No vouches recorded yet.", delete_after=5)
return
sorted_vouches = sorted(vouch_counts.items(), key=lambda x: x[1], reverse=True)[:10]
embed = discord.Embed(
title="🏆 Vouch Leaderboard",
color=0xf0b132
)
medals = ["🥇", "🥈", "🥉"]
lines = []
for i, (uid, count) in enumerate(sorted_vouches):
medal = medals[i] if i < 3 else f"`#{i+1}`"
member = ctx.guild.get_member(int(uid))
name = member.display_name if member else f"Unknown ({uid})"
lines.append(f"{medal} **{name}** — {count} vouches")
embed.description = "\n".join(lines)
embed.set_footer(text="FakeVouchBot • Session data only")
await ctx.send(embed=embed)
@bot.command(name="fvclear")
@commands.has_permissions(administrator=True)
async def fvclear(ctx, target: discord.Member = None):
if target is None:
await ctx.send("❌ Mention a member to clear. Usage: `!fvclear @user`", delete_after=5)
return
uid = str(target.id)
if uid in vouch_counts:
del vouch_counts[uid]
await ctx.send(f"🗑️ Cleared vouch count for **{target.display_name}**.", delete_after=5)
@bot.command(name="fvclearall")
@commands.has_permissions(administrator=True)
async def fvclearall(ctx):
vouch_counts.clear()
await ctx.send("🗑️ All vouch counts have been reset.", delete_after=5)
@fake_vouch.error
async def fake_vouch_error(ctx, error):
if isinstance(error, commands.MissingPermissions):
await ctx.send("❌ You need **Administrator** permission to use this.", delete_after=5)
elif isinstance(error, commands.BadArgument):
await ctx.send("❌ Invalid arguments. Use `!fv help` for usage.", delete_after=5)
bot.run(os.getenv("DISCORD_TOKEN"))