mirror of https://github.com/sgoudham/Enso-Bot.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
301 lines
13 KiB
Python
301 lines
13 KiB
Python
5 years ago
|
import asyncio
|
||
5 years ago
|
import datetime
|
||
|
import random
|
||
|
|
||
5 years ago
|
from discord import Colour, Embed, Member
|
||
5 years ago
|
from discord.ext import commands
|
||
5 years ago
|
from discord.ext.commands import BucketType
|
||
5 years ago
|
from discord.ext.commands import cooldown, command
|
||
5 years ago
|
|
||
5 years ago
|
import settings
|
||
5 years ago
|
|
||
|
|
||
5 years ago
|
# Set up the Cog
|
||
5 years ago
|
class Embeds(commands.Cog):
|
||
|
def __init__(self, bot):
|
||
|
self.bot = bot
|
||
|
|
||
5 years ago
|
# ~kiss command which allows users to kiss a person in the server
|
||
5 years ago
|
@command(name="kiss", aliases=["Kiss"])
|
||
5 years ago
|
# Added a cooldown, only 1 instance of the command can be sent every second per user
|
||
5 years ago
|
@cooldown(1, 1, BucketType.user)
|
||
5 years ago
|
async def kiss(self, ctx, target: Member):
|
||
5 years ago
|
|
||
5 years ago
|
# Surround with try/except to catch any exceptions that may occur
|
||
5 years ago
|
try:
|
||
|
|
||
5 years ago
|
# If the channel that the command has been sent is in the list of accepted channels
|
||
5 years ago
|
if str(ctx.channel) in settings.channels:
|
||
5 years ago
|
|
||
|
# Open the file containing the kissing gifs
|
||
5 years ago
|
with open('images/FunCommands/kissing.txt') as file:
|
||
5 years ago
|
# Store content of the file in kissing_array
|
||
5 years ago
|
kissing_array = file.readlines()
|
||
|
|
||
5 years ago
|
# Set member as the author
|
||
|
member = ctx.message.author
|
||
|
# Get the member avatar
|
||
|
userAvatar = member.avatar_url
|
||
|
|
||
|
# Set up the embed to display a random kissing gif
|
||
5 years ago
|
embed = Embed(
|
||
5 years ago
|
title=f"<a:huh:676195228872474643> <a:huh:676195228872474643> | **{member.display_name}** kissed **{target.display_name}**",
|
||
5 years ago
|
colour=Colour(int(random.choice(settings.colour_list))),
|
||
|
timestamp=datetime.datetime.utcnow())
|
||
5 years ago
|
embed.set_image(url=random.choice(kissing_array))
|
||
|
embed.set_footer(text=f"Requested by {member}", icon_url='{}'.format(userAvatar))
|
||
|
|
||
|
# Send the embedded message to the user
|
||
|
await ctx.send(embed=embed)
|
||
5 years ago
|
|
||
|
# else the command is sent in an invalid channel
|
||
|
else:
|
||
|
# Call error_function() and display it to the user
|
||
|
message = await ctx.send(error_function())
|
||
|
|
||
|
# Let the user read the message for 2.5 seconds
|
||
|
await asyncio.sleep(2.5)
|
||
|
# Delete the message
|
||
|
await message.delete()
|
||
|
|
||
|
except FileNotFoundError as e:
|
||
|
print(e)
|
||
|
|
||
|
# ~kill command which allows users to kill a person in the server
|
||
5 years ago
|
@command(name="kill", aliases=["Kill"])
|
||
5 years ago
|
# Added a cooldown, only 1 instance of the command can be sent every second per user
|
||
5 years ago
|
@cooldown(1, 1, BucketType.user)
|
||
5 years ago
|
async def kill(self, ctx, target: Member):
|
||
5 years ago
|
|
||
|
# Surround with try/except to catch any exceptions that may occur
|
||
|
try:
|
||
|
|
||
|
# If the channel that the command has been sent is in the list of accepted channels
|
||
5 years ago
|
if str(ctx.channel) in settings.channels:
|
||
5 years ago
|
|
||
|
# Open the file containing the killing gifs
|
||
|
with open('images/FunCommands/killing.txt') as file:
|
||
|
# Store content of the file in killing_array
|
||
|
killing_array = file.readlines()
|
||
|
|
||
5 years ago
|
# Set member as the author
|
||
|
member = ctx.message.author
|
||
|
# Get the member avatar
|
||
|
userAvatar = member.avatar_url
|
||
5 years ago
|
|
||
5 years ago
|
# Set up the embed to display a random killing gif
|
||
5 years ago
|
embed = Embed(
|
||
5 years ago
|
title=f"<:monkaW:718960264896184380> <:monkaW:718960264896184380> | **{member.display_name}** killed **{target.display_name}**",
|
||
5 years ago
|
colour=Colour(int(random.choice(settings.colour_list))),
|
||
|
timestamp=datetime.datetime.utcnow())
|
||
5 years ago
|
embed.set_image(url=random.choice(killing_array))
|
||
|
embed.set_footer(text=f"Requested by {member}", icon_url='{}'.format(userAvatar))
|
||
5 years ago
|
|
||
5 years ago
|
# Send the embedded message to the user
|
||
|
await ctx.send(embed=embed)
|
||
5 years ago
|
|
||
|
# else the command is sent in an invalid channel
|
||
|
else:
|
||
|
# Call error_function() and display it to the user
|
||
|
message = await ctx.send(error_function())
|
||
|
|
||
|
# Let the user read the message for 2.5 seconds
|
||
|
await asyncio.sleep(2.5)
|
||
|
# Delete the message
|
||
|
await message.delete()
|
||
|
|
||
|
except FileNotFoundError as e:
|
||
|
print(e)
|
||
|
|
||
|
# ~cuddle command which allows users to cuddle a person in the server
|
||
5 years ago
|
@command(name="cuddle", aliases=["Cuddle"])
|
||
5 years ago
|
# Added a cooldown, only 1 instance of the command can be sent every second per user
|
||
5 years ago
|
@cooldown(1, 1, BucketType.user)
|
||
5 years ago
|
async def cuddle(self, ctx, target: Member):
|
||
5 years ago
|
|
||
|
# Surround with try/except to catch any exceptions that may occur
|
||
|
try:
|
||
|
|
||
|
# If the channel that the command has been sent is in the list of accepted channels
|
||
5 years ago
|
if str(ctx.channel) in settings.channels:
|
||
5 years ago
|
|
||
|
# Open the file containing the cuddling gifs
|
||
|
with open('images/FunCommands/cuddling.txt') as file:
|
||
|
# Store content of the file in cuddling_array
|
||
|
cuddling_array = file.readlines()
|
||
|
|
||
5 years ago
|
# Set member as the author
|
||
|
member = ctx.message.author
|
||
|
# Get the member avatar
|
||
|
userAvatar = member.avatar_url
|
||
5 years ago
|
|
||
5 years ago
|
# Set up the embed to display a random cuddling gif
|
||
5 years ago
|
embed = Embed(
|
||
5 years ago
|
title=f"<:blushlook1:677310734123663363> <:blushlook2:679524467248201769> | **{member.display_name}** cuddled **{target.display_name}**",
|
||
5 years ago
|
colour=Colour(int(random.choice(settings.colour_list))),
|
||
|
timestamp=datetime.datetime.utcnow())
|
||
5 years ago
|
embed.set_image(url=random.choice(cuddling_array))
|
||
|
embed.set_footer(text=f"Requested by {member}", icon_url='{}'.format(userAvatar))
|
||
5 years ago
|
|
||
5 years ago
|
# Send the embedded message to the user
|
||
|
await ctx.send(embed=embed)
|
||
5 years ago
|
|
||
5 years ago
|
# else the command is sent in an invalid channel
|
||
5 years ago
|
else:
|
||
5 years ago
|
# Call error_function() and display it to the user
|
||
5 years ago
|
message = await ctx.send(error_function())
|
||
5 years ago
|
|
||
|
# Let the user read the message for 2.5 seconds
|
||
|
await asyncio.sleep(2.5)
|
||
|
# Delete the message
|
||
|
await message.delete()
|
||
5 years ago
|
|
||
5 years ago
|
except FileNotFoundError as e:
|
||
|
print(e)
|
||
|
|
||
5 years ago
|
# ~slap command which allows users to cuddle a person in the server
|
||
5 years ago
|
@command(name="slap", aliases=["Slap"])
|
||
5 years ago
|
# Added a cooldown, only 1 instance of the command can be sent every second per user
|
||
5 years ago
|
@cooldown(1, 1, BucketType.user)
|
||
5 years ago
|
async def slap(self, ctx, target: Member):
|
||
5 years ago
|
|
||
5 years ago
|
# Surround with try/except to catch any exceptions that may occur
|
||
5 years ago
|
try:
|
||
|
|
||
5 years ago
|
# If the channel that the command has been sent is in the list of accepted channels
|
||
5 years ago
|
if str(ctx.channel) in settings.channels:
|
||
5 years ago
|
|
||
|
# Open the file containing the cuddling gifs
|
||
5 years ago
|
with open('images/FunCommands/slapping.txt') as file:
|
||
5 years ago
|
# Store content of the file in cuddling_array
|
||
5 years ago
|
slapping_array = file.readlines()
|
||
|
|
||
5 years ago
|
# Set member as the author
|
||
|
member = ctx.message.author
|
||
|
# Get the member avatar
|
||
|
userAvatar = member.avatar_url
|
||
5 years ago
|
|
||
5 years ago
|
# Set up the embed to display a random slapping gif
|
||
5 years ago
|
embed = Embed(
|
||
5 years ago
|
title=f"<:baka:718942872061083678> <:baka:718942872061083678> | **{member.display_name}** slapped **{target.display_name}**",
|
||
5 years ago
|
colour=Colour(int(random.choice(settings.colour_list))),
|
||
|
timestamp=datetime.datetime.utcnow())
|
||
5 years ago
|
embed.set_image(url=random.choice(slapping_array))
|
||
|
embed.set_footer(text=f"Requested by {member}", icon_url='{}'.format(userAvatar))
|
||
5 years ago
|
|
||
5 years ago
|
# Send the embedded message to the user
|
||
|
await ctx.send(embed=embed)
|
||
5 years ago
|
|
||
5 years ago
|
# else the command is sent in an invalid channel
|
||
5 years ago
|
else:
|
||
5 years ago
|
# Call error_function() and display it to the user
|
||
5 years ago
|
message = await ctx.send(error_function())
|
||
5 years ago
|
|
||
5 years ago
|
# Let the user read the message for 2.5 seconds
|
||
|
await asyncio.sleep(2.5)
|
||
|
# Delete the message
|
||
|
await message.delete()
|
||
5 years ago
|
|
||
5 years ago
|
except FileNotFoundError as e:
|
||
|
print(e)
|
||
|
|
||
5 years ago
|
# ~slap command which allows users to cuddle a person in the server
|
||
5 years ago
|
@command(name="pat", aliases=["Pat"])
|
||
5 years ago
|
# Added a cooldown, only 1 instance of the command can be sent every second per user
|
||
5 years ago
|
@cooldown(1, 1, BucketType.user)
|
||
5 years ago
|
async def pat(self, ctx, target: Member):
|
||
5 years ago
|
|
||
5 years ago
|
# Surround with try/except to catch any exceptions that may occur
|
||
5 years ago
|
try:
|
||
|
|
||
5 years ago
|
# If the channel that the command has been sent is in the list of accepted channels
|
||
5 years ago
|
if str(ctx.channel) in settings.channels:
|
||
5 years ago
|
|
||
5 years ago
|
# Open the file containing the patting gifs
|
||
|
with open('images/FunCommands/patting.txt') as file:
|
||
|
# Store content of the file in patting_array
|
||
|
patting_array = file.readlines()
|
||
|
|
||
5 years ago
|
# Set member as the author
|
||
|
member = ctx.message.author
|
||
|
# Get the member avatar
|
||
|
userAvatar = member.avatar_url
|
||
|
|
||
|
# Set up the embed to display a random patting gif
|
||
5 years ago
|
embed = Embed(
|
||
5 years ago
|
title=f"<:xoxo:679893117482303564> <:xoxo:679893117482303564> | **{member.display_name}** patted **{target.display_name} on the head**",
|
||
5 years ago
|
colour=Colour(int(random.choice(settings.colour_list))),
|
||
|
timestamp=datetime.datetime.utcnow())
|
||
5 years ago
|
embed.set_image(url=random.choice(patting_array))
|
||
|
embed.set_footer(text=f"Requested by {member}", icon_url='{}'.format(userAvatar))
|
||
|
|
||
|
# Send the embedded message to the user
|
||
|
await ctx.send(embed=embed)
|
||
5 years ago
|
|
||
5 years ago
|
# else the command is sent in an invalid channel
|
||
5 years ago
|
else:
|
||
5 years ago
|
# Call error_function() and display it to the user
|
||
5 years ago
|
message = await ctx.send(error_function())
|
||
5 years ago
|
|
||
5 years ago
|
# Let the user read the message for 2.5 seconds
|
||
|
await asyncio.sleep(2.5)
|
||
|
# Delete the message
|
||
|
await message.delete()
|
||
5 years ago
|
|
||
|
except FileNotFoundError as e:
|
||
|
print(e)
|
||
|
|
||
5 years ago
|
# ~lemon command which allows users to hand people lemons to members in the user
|
||
5 years ago
|
@command(name="lemon", aliases=["Lemon"])
|
||
5 years ago
|
# Added a cooldown, only 1 instance of the command can be sent every second per user
|
||
5 years ago
|
@cooldown(1, 1, BucketType.user)
|
||
5 years ago
|
async def lemon(self, ctx, target: Member):
|
||
5 years ago
|
|
||
|
lemon_array = ["https://media.discordapp.net/attachments/669812887564320769/720093589056520202/lemon.gif",
|
||
|
"https://media.discordapp.net/attachments/669812887564320769/720093575492272208/lemon2.gif",
|
||
|
"https://media.discordapp.net/attachments/718484280925224981/719629805263257630/lemon.gif"]
|
||
5 years ago
|
|
||
|
# Surround with try/except to catch any exceptions that may occur
|
||
5 years ago
|
try:
|
||
|
|
||
5 years ago
|
# If the channel that the command has been sent is in the list of accepted channels
|
||
5 years ago
|
if str(ctx.channel) in settings.channels:
|
||
5 years ago
|
|
||
|
# Set member as the author
|
||
5 years ago
|
member = ctx.message.author
|
||
5 years ago
|
# Get the member avatar
|
||
5 years ago
|
userAvatar = member.avatar_url
|
||
|
|
||
5 years ago
|
# Set up the embed to display a random lemon gif
|
||
5 years ago
|
embed = Embed(
|
||
5 years ago
|
title=f"<a:huh:676195228872474643> <a:huh:676195228872474643> | **{member.display_name}** Gives A Lemon To **{target.display_name}**",
|
||
5 years ago
|
colour=Colour(int(random.choice(settings.colour_list))),
|
||
|
timestamp=datetime.datetime.utcnow())
|
||
5 years ago
|
embed.set_image(url=random.choice(lemon_array))
|
||
5 years ago
|
embed.set_footer(text=f"Requested by {member}", icon_url='{}'.format(userAvatar))
|
||
5 years ago
|
|
||
5 years ago
|
# Send the embedded message to the user
|
||
5 years ago
|
await ctx.send(embed=embed)
|
||
|
|
||
5 years ago
|
# else the command is sent in an invalid channel
|
||
5 years ago
|
else:
|
||
5 years ago
|
# Call error_function() and display it to the user
|
||
5 years ago
|
message = await ctx.send(error_function())
|
||
5 years ago
|
|
||
|
# Let the user read the message for 2.5 seconds
|
||
|
await asyncio.sleep(2.5)
|
||
|
# Delete the message
|
||
|
await message.delete()
|
||
5 years ago
|
|
||
|
except FileNotFoundError as e:
|
||
|
print(e)
|
||
|
|
||
5 years ago
|
|
||
5 years ago
|
# Error handling function to make sure that the commands only work in "enso-chan-commands"
|
||
5 years ago
|
def error_function():
|
||
5 years ago
|
return "Sorry! I only work in <#721449922838134876>"
|
||
5 years ago
|
|
||
|
|
||
5 years ago
|
def setup(bot):
|
||
|
bot.add_cog(Embeds(bot))
|