import discord
from discord.ext import commands
from discord import app_commands
from discord import Color
from dotenv import load_dotenv
import os
import random
load_dotenv()
TOKEN = os.getenv('TOKEN')
intents = discord.Intents.default() # the intents parameter is crucial for
defining what events your bot can listen to and react to
intents.messages = True # Basically permissions for your bot.
intents.message_content = True
intents.members = True
intents.guilds = True
bot = commands.Bot(command_prefix='.', intents=intents) # Cmd syntax + intents
=intents means to pass the intents to bot/client
@bot.event
async def on_ready():
print(f'Logged in as {bot.user.name} (ID: {bot.user.id})') # this is called
when the bot has successfully connected to Discord and is ready to operate
try:
GUILD = discord.Object(id=1339005915742867526)
synced = await bot.tree.sync(guild=GUILD)
print(f'commands synced.') # Forces the bot to develop within the guild
server and to sync everything
except Exception as e:
print(f'error syncing commands: {e}')
print('------')
# Includes details about the message, channel, guild, and user that triggered the
command.
@bot.command()
async def ping(ctx): # CTX Provides information about the command's invocation
context
await ctx.send('Pong!') # Waits for the message to be sent before proceeding
await ctx.message.delete()
@bot.command()
async def hello(ctx):
await ctx.send('Hello there!')
await ctx.message.delete() # Function that sends hello message when u
type .hello
GUILD_ID = discord.Object(id=1339005915742867526) # THIS WILL BE USED TO MAKE SURE
OUR TESTING IS ONLY IN OUR SERVER AND NOT GLOBAL
@bot.tree.command(name="8ball", description="Consult 8ball to receive an answer.",
guild=GUILD_ID)
@app_commands.describe(question="The question you want answers to.")
async def askQuestion(interaction: discord.Interaction, question: str): #
Represents the interaction event, Specifies that users must provide a question, and
adds a parameter.
responses = ["Reply hazy, try again",
"signs point to a yes",
"yes",
"no",
"maybe",
"no... baka",
"yuh fosho",
"Sure, Without a doubt",
"maybe man idk lol",
"Outlook not so good",
"You'll be the judge",
"Might be possible",
"How bout u stfu Nigger",
"Shut up and suck my cock",
"You're not ohio blud",
"STFU ALREADY MAN PLEASE"]
answer = random.choice(responses)
await interaction.response.send_message(f"🎱 **Question:** {question}\
n**Answer:** {answer}")
@bot.tree.command(name="gayrate", description="Rates how gay someone is.",
guild=GUILD_ID)
@app_commands.describe(user="The user you want to rate, leave empty to rate
yourself")
async def gayRate(interaction: discord.Interaction, user: discord.User = None): #
it makes the parameter optional as in any1 in server or urself.
if user is None:
user = interaction.user
rating = random.randint(0, 100)
if rating < 40:
emoji = "🔥"
elif rating < 70:
emoji = "🤑"
else:
emoji = ""
await interaction.response.send_message(f"**{user.name}** is **{rating}%** gay!
{emoji}")
@bot.tree.command(name="hotpercentage", description="Rates how hot someone is",
guild=GUILD_ID)
@app_commands.describe(user="The user you want to rate, leave empty to rate
yourself")
async def hotCalc(interaction: discord.Interaction, user: discord.User = None):
if user is None:
user = interaction.user
rating = random.randint(0, 100)
if rating < 40:
emoji = "🤮"
elif rating < 70:
emoji = "💗"
else:
emoji = "😍"
await interaction.response.send_message(f"**{user.name}** is **{rating}%** hot
{emoji}")
@bot.tree.command(name="coinflip", description="flips a coin", guild=GUILD_ID)
async def coinFlip(interaction: discord.Interaction):
responses = ["Heads", "Tails"]
headstails = random.choice(responses)
await interaction.response.send_message(f"{headstails}")
@bot.tree.command(name="fakenitro", description="Claim a free gift!",
guild=GUILD_ID)
async def fakeNitroEmbed(interaction: discord.Interaction):
hex_color = int('CFD2F5', 16)
embed = discord.Embed(title="**You've been gifted a subscription!**",
description="You've been gifted Nitro for **1 month!**", color=hex_color)
embed.set_thumbnail(url="https://media.discordapp.net/attachments/
1313160789611380756/1349081838236471356/nitro_logo.jpeg?
ex=67d1cdde&is=67d07c5e&hm=fc1be4e4eb3b42a4e6b20322e4b2273265344b17b10e6486a5ac8a4e
d3a881e7&=&format=webp&width=436&height=436")
embed.set_footer(text="Its not real Or is it ? Find out now...")
await interaction.response.send_message(embed=embed)
class view(discord.ui.View):
@discord.ui.button()
bot.run(TOKEN)