Adding more commentary and reformatting some code

pull/2/head
sgoudham 4 years ago
parent 19e3620ee8
commit 2c13b6bc10

@ -5,88 +5,111 @@ from discord.ext import commands, menus
from discord.ext.commands import command from discord.ext.commands import command
# Function to allow the first page of the help commands (Fun Commands)
def fun_function(guild_icon, enso_name, enso_icon): def fun_function(guild_icon, enso_name, enso_icon):
# Setting up the Embed for the Fun Commands
fun_commands = Embed(title="```(っ◔◡◔)っ Fun Commands (っ◔◡◔)っ```", fun_commands = Embed(title="```(っ◔◡◔)っ Fun Commands (っ◔◡◔)っ```",
colour=Colour(0xFF69B4), colour=Colour(0xFF69B4),
timestamp=datetime.datetime.utcnow()) timestamp=datetime.datetime.utcnow())
# Setting thumbnail and author
fun_commands.set_thumbnail(url=guild_icon) fun_commands.set_thumbnail(url=guild_icon)
fun_commands.set_author(name=enso_name, fun_commands.set_author(name=enso_name,
icon_url=enso_icon) icon_url=enso_icon)
fun_fields = [("\u200b", "`➳ ~attack [person]`" + # Setting up the fields in a separate array
"\n Allows the user to throw an insult to a person in the server" + fun_fields = [
"\n *(Perms: Co-Owner)*", True), ("\u200b", "`➳ ~attack [person]`" +
("\u200b", "`➳ ~comp [person]`" + "\n Allows the user to throw an insult to a person in the server" +
"\n Allows the user to compliment a person in the server" + "\n *(Perms: Co-Owner)*", True),
"\n *(Perms: Everyone)*", True), ("\u200b", "`➳ ~comp [person]`" +
("\u200b", "`➳ ~8ball [text]`" + "\n Allows the user to compliment a person in the server" +
"\n Allows the user to ask a question and 8ball will give a custom response" + "\n *(Perms: Everyone)*", True),
"\n *(Perms: everyone)*", True), ("\u200b", "`➳ ~8ball [text]`" +
("\u200b", "`➳ ~lemon [person]`" + "\n Allows the user to ask a question and 8ball will give a custom response" +
"\n Allows the user to give a lemon to a person in the server" + "\n *(Perms: everyone)*", True),
"\n *(Perms: Everyone)*", True), ("\u200b", "`➳ ~flip`" +
("\u200b", "`➳ ~slap [person]`" + "\n Allows the user to 'throw a coin' and get a response with a 50/50 chance" +
"\n Allows the user to slap a person in the server" + "\n *(Perms: Everyone)*", True),
"\n *(Perms: Everyone)*", True), ("\u200b", "`➳ ~doggo`" +
("\u200b", "`➳ ~kill [person]`" + "\n Allows the user to look at an image of a doggo (Over 20k Images Available" +
"\n Allows the user to kill a person in the server" + "\n *(Perms: Everyone)*", True)]
"\n *(Perms: Everyone)*", True),
("\u200b", "`➳ ~pat [person]`" + # Setting up the Embed for the Fun Commands
"\n Allows the user to pat a person in the server" + fun_commands_2 = Embed(title="```(っ◔◡◔)っ Fun Commands 2 (っ◔◡◔)っ```",
"\n *(Perms: Everyone)*", True), colour=Colour(0xFF69B4),
("\u200b", "`➳ ~kiss [person]`" + timestamp=datetime.datetime.utcnow())
"\n Allows the user to kiss a person in the server" +
"\n *(Perms: Everyone)*", True), # Setting thumbnail and author
("\u200b", "`➳ ~cuddle [person]`" + fun_commands_2.set_thumbnail(url=guild_icon)
"\n Allows the user to cuddle a person in the server" + fun_commands_2.set_author(name=enso_name,
"\n *(Perms: Everyone)*", True), icon_url=enso_icon)
("\u200b", "`➳ ~flip`" +
"\n Allows the user to 'throw a coin' and get a response with a 50/50 chance" + # Setting up the fields in a separate array
"\n *(Perms: Everyone)*", True), fun_fields_2 = [
("\u200b", "`➳ ~doggo`" + ("\u200b", "`➳ ~lemon [person]`" +
"\n Allows the user to look at an image of a doggo (Over 20k Images Available" + "\n Allows the user to give a lemon to a person in the server" +
"\n *(Perms: Everyone)*", True)] "\n *(Perms: Everyone)*", True),
("\u200b", "`➳ ~slap [person]`" +
"\n Allows the user to slap a person in the server" +
"\n *(Perms: Everyone)*", True),
("\u200b", "`➳ ~kill [person]`" +
"\n Allows the user to kill a person in the server" +
"\n *(Perms: Everyone)*", True),
("\u200b", "`➳ ~pat [person]`" +
"\n Allows the user to pat a person in the server" +
"\n *(Perms: Everyone)*", True),
("\u200b", "`➳ ~kiss [person]`" +
"\n Allows the user to kiss a person in the server" +
"\n *(Perms: Everyone)*", True),
("\u200b", "`➳ ~cuddle [person]`" +
"\n Allows the user to cuddle a person in the server" +
"\n *(Perms: Everyone)*", True)]
# Add the fun_commands fields to the embed # Add the fun_commands fields to the embed
for name, value, inline in fun_fields: for name, value, inline in fun_fields:
fun_commands.add_field(name=name, value=value, inline=inline) fun_commands.add_field(name=name, value=value, inline=inline)
return fun_commands # Add the fun_commands_2 fields to the embed
for name, value, inline in fun_fields_2:
fun_commands_2.add_field(name=name, value=value, inline=inline)
return fun_commands, fun_commands_2
# Function to allow the first page of the help commands (Waifu/Husbandos)
def waifu_husbando_function(guild_icon, enso_name, enso_icon): def waifu_husbando_function(guild_icon, enso_name, enso_icon):
# Setting up the Embed for the Waifu/Husbandos
waifu_husbando_commands = Embed(title="```(っ◔◡◔)っ Waifus/Husbando Commands (っ◔◡◔)っ```", waifu_husbando_commands = Embed(title="```(っ◔◡◔)っ Waifus/Husbando Commands (っ◔◡◔)っ```",
colour=Colour(0xFF69B4), colour=Colour(0xFF69B4),
timestamp=datetime.datetime.utcnow()) timestamp=datetime.datetime.utcnow())
# Setting thumbnail and author
waifu_husbando_commands.set_thumbnail(url=guild_icon) waifu_husbando_commands.set_thumbnail(url=guild_icon)
waifu_husbando_commands.set_author(name=enso_name, waifu_husbando_commands.set_author(name=enso_name,
icon_url=enso_icon) icon_url=enso_icon)
waifu_husbando_fields = [("\u200b", "`➳ ~w [waifu]`" + # Setting up the fields in a separate array
"\n Allows for a randomly generated image of a Waifu to be shown" + waifu_husbando_fields = [
"\n *(Perms: Everyone)*", True), ("\u200b", "`➳ ~w [waifu]`" +
("\u200b", "`➳ ~h [husbando]`" + "\n Allows for a randomly generated image of a Waifu to be shown" +
"\n Allows for a randomly generated image of a Husbando to be shown" + "\n *(Perms: Everyone)*", True),
"\n *(Perms: Everyone)*", True), ("\u200b", "`➳ ~h [husbando]`" +
("\u200b", "`➳ ~w list`" + "\n Allows for a randomly generated image of a Husbando to be shown" +
"\n Returns a list of Waifu's that are in the bot " + "\n *(Perms: Everyone)*", True),
"\n *(Perms: Everyone)*", True), ("\u200b", "`➳ ~w list`" +
("\u200b", "`➳ ~h list`" + "\n Returns a list of Waifu's that are in the bot " +
"\n Returns a list of Husbando's that are in the bot " + "\n *(Perms: Everyone)*", True),
"\n *(Perms: Everyone)*", True), ("\u200b", "`➳ ~h list`" +
("\u200b", "`➳ ~enso [person]`" + "\n Returns a list of Husbando's that are in the bot " +
"\n Allows for a randomly generated image of the member specified" + "\n *(Perms: Everyone)*", True),
"\n (Using ~enso by itself shall generate a random image of a person within all the server)" + ("\u200b", "`➳ ~enso [person]`" +
"\n *(Perms: Everyone)*", True), "\n Allows for a randomly generated image of the member specified" +
("\u200b", "`➳ ~enso [person]`" + "\n (Using ~enso by itself shall generate a random image of a person within all the server)" +
"\n Allows for a randomly generated image of the member specified" + "\n *(Perms: Everyone)*", True),
"\n (Using ~enso by itself shall generate a random image of a person within all the server)" + ("\u200b", "`➳ ~enso list`" +
"\n *(Perms: Everyone)*", True), "\n Returns a list of the people's images currently in the bot" +
("\u200b", "`➳ ~enso list`" + "\n *(Perms: Everyone)*", True)]
"\n Returns a list of the people's images currently in the bot" +
"\n *(Perms: Everyone)*", True)]
# Add the waifu_husbando_commands fields to the embed # Add the waifu_husbando_commands fields to the embed
for name, value, inline in waifu_husbando_fields: for name, value, inline in waifu_husbando_fields:
@ -95,42 +118,47 @@ def waifu_husbando_function(guild_icon, enso_name, enso_icon):
return waifu_husbando_commands return waifu_husbando_commands
# Function to allow the first page of the help commands (Miscellaneous)
def misc_function(guild_icon, enso_name, enso_icon): def misc_function(guild_icon, enso_name, enso_icon):
# Setting up the Embed for the Miscellaneous commands
misc_commands = Embed(title="```(っ◔◡◔)っ Misc Commands (っ◔◡◔)っ```", misc_commands = Embed(title="```(っ◔◡◔)っ Misc Commands (っ◔◡◔)っ```",
colour=Colour(0xFF69B4), colour=Colour(0xFF69B4),
timestamp=datetime.datetime.utcnow()) timestamp=datetime.datetime.utcnow())
# Setting thumbnail and author
misc_commands.set_thumbnail(url=guild_icon) misc_commands.set_thumbnail(url=guild_icon)
misc_commands.set_author(name=enso_name, misc_commands.set_author(name=enso_name,
icon_url=enso_icon) icon_url=enso_icon)
misc_fields = [("\u200b", "`➳ ~ping`" + # Setting up the fields in a separate array
"\n Returns Pong! Along With The Latency in ms" + misc_fields = [
"\n *(Perms: Co-Owner)*", True), ("\u200b", "`➳ ~ping`" +
("\u200b", "`➳ ~rolemenu`" + "\n Returns Pong! Along With The Latency in ms" +
"\n Allows for the users to get self ping-able roles" + "\n *(Perms: Co-Owner)*", True),
"\n *(Perms: Co-Owner)*", True), ("\u200b", "`➳ ~rolemenu`" +
("\u200b", "`➳ ~dm [person]`" + "\n Allows for the users to get self ping-able roles" +
"\n Allows Hammmy to dm anyone in the server through Enso~Chan!" + "\n *(Perms: Co-Owner)*", True),
"\n *(Perms: Co-Owner)*", True), ("\u200b", "`➳ ~dm [person]`" +
("\u200b", "`➳ ~userinfo`" + "\n Allows Hammy to dm anyone in the server through Enso~Chan!" +
"\n Returns information about the user (Name, Roles, Joined Date, Created Date, etc)" + "\n *(Perms: Co-Owner)*", True),
"\n *(Perms: Everyone)*", True), ("\u200b", "`➳ ~userinfo`" +
("\u200b", "`➳ ~serverinfo`" + "\n Returns information about the user (Name, Roles, Joined Date, Created Date, etc)" +
"\n Returns information about the server (Owner, Members, Region, Bots etc etc)" + "\n *(Perms: Everyone)*", True),
"\n *(Perms: Everyone)*", True), ("\u200b", "`➳ ~serverinfo`" +
("\u200b", "`➳ ~rules`" + "\n Returns information about the server (Owner, Members, Region, Bots etc etc)" +
"\n Returns the entire ruleset for the server" + "\n *(Perms: Everyone)*", True),
"\n *(Perms: Everyone)*", True), ("\u200b", "`➳ ~rules`" +
("\u200b", "`➳ ~roles`" + "\n Returns the entire ruleset for the server" +
"\n Shows you how the leveling and xp system works, as well as displaying the order of leveled roles" + "\n *(Perms: Everyone)*", True),
"\n *(Perms: Everyone)*", True), ("\u200b", "`➳ ~roles`" +
("\u200b", "`➳ ~remindme [time] [text]`" + "\n Shows you how the leveling and xp system works, as well as displaying the order of leveled roles" +
"\n Allows the user to get Enso~Chan to remind them in dms of anything that they want" + "\n *(Perms: Everyone)*", True),
"\n *(Perms: Everyone)*", True), ("\u200b", "`➳ ~remindme [time] [text]`" +
("\u200b", "`➳ ~help`" + "\n Allows the user to get Enso~Chan to remind them in dms of anything that they want" +
"\n Allows you to see every command in the bot so far" + "\n *(Perms: Everyone)*", True),
"\n *(Perms: Everyone)*", True)] ("\u200b", "`➳ ~help`" +
"\n Allows you to see every command in the bot so far" +
"\n *(Perms: Everyone)*", True)]
# Add the misc_commands fields to the embed # Add the misc_commands fields to the embed
for name, value, inline in misc_fields: for name, value, inline in misc_fields:
@ -144,10 +172,12 @@ def stop_embed(self):
enso_icon = self.bot.user.avatar_url enso_icon = self.bot.user.avatar_url
enso_name = self.bot.user.display_name enso_name = self.bot.user.display_name
misc_commands = Embed(title="```Help Commands Embed Closed!```", # Set up the Embed to display when the user reacts with the stop reaction
misc_commands = Embed(title="**Help Commands Embed Closed!**",
colour=Colour(0xFF69B4), colour=Colour(0xFF69B4),
timestamp=datetime.datetime.utcnow()) timestamp=datetime.datetime.utcnow())
# Set the name and the icon for Enso~Chan
misc_commands.set_author(name=enso_name, misc_commands.set_author(name=enso_name,
icon_url=enso_icon) icon_url=enso_icon)
@ -155,23 +185,20 @@ def stop_embed(self):
def embeds(self): def embeds(self):
try: # Define guild icon, enso bot icon and enso bot name
# Define guild icon, enso bot icon and enso bot name guild_icon = self.ctx.guild.icon_url
guild_icon = self.ctx.guild.icon_url enso_icon = self.bot.user.avatar_url
enso_icon = self.bot.user.avatar_url enso_name = self.bot.user.display_name
enso_name = self.bot.user.display_name
page1 = fun_function(guild_icon, enso_name, enso_icon)
page2 = waifu_husbando_function(guild_icon, enso_name, enso_icon)
page3 = misc_function(guild_icon, enso_name, enso_icon)
# Store all the categories of the menu to an array called pages # Set the different pages of the embed
pages = [page1, page2, page3] page1, page2 = fun_function(guild_icon, enso_name, enso_icon)
page3 = waifu_husbando_function(guild_icon, enso_name, enso_icon)
page4 = misc_function(guild_icon, enso_name, enso_icon)
return pages # Store all the categories of the menu to an array called pages
pages = [page1, page2, page3, page4]
except Exception as ex: return pages
print(ex)
class HelpMenu(menus.Menu): class HelpMenu(menus.Menu):
@ -224,11 +251,15 @@ class ReactionMenu(commands.Cog):
def __init__(self, bot): def __init__(self, bot):
self.bot = bot self.bot = bot
# ~help command that returns a menu for help commands controlled by reactions
@command(name="help", aliases=["Help"]) @command(name="help", aliases=["Help"])
async def help(self, ctx): async def help(self, ctx):
# Local Variable i to allow the index of the pages[] to be modified
i = 0 i = 0
m = HelpMenu(i, self)
await m.start(ctx) # Send the menu to the display
menu = HelpMenu(i, self)
await menu.start(ctx)
def setup(bot): def setup(bot):

Loading…
Cancel
Save