aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Jeremiah Boby <[email protected]>2019-02-27 08:46:37 +0000
committerGravatar GitHub <[email protected]>2019-02-27 08:46:37 +0000
commit41f7bf13504dd5eca1f554783542f838ac457ada (patch)
treeedf6a7a8370645bcb819896b4c652eaad3423b5d
parentMerge pull request #120 from RohanJnr/small_changes_iceman (diff)
parentAddress grammatical errors. (diff)
Merge pull request #112 from RohanJnr/be-my-valentine-iceman
Added command .bemyvalentine
-rw-r--r--bot/resources/valentines/bemyvalentine_valentines.json45
-rw-r--r--bot/seasons/valentines/be_my_valentine.py241
2 files changed, 286 insertions, 0 deletions
diff --git a/bot/resources/valentines/bemyvalentine_valentines.json b/bot/resources/valentines/bemyvalentine_valentines.json
new file mode 100644
index 00000000..7d5d3705
--- /dev/null
+++ b/bot/resources/valentines/bemyvalentine_valentines.json
@@ -0,0 +1,45 @@
+{
+ "valentine_poems": [
+
+ "If you were my rose,\nthen I'd be your sun,\npainting you rainbows when the rains come.\nI'd change my orbit to banish the night,\nas to keep you in my nurturing light.",
+ "If you were my world, then I'd be your moon,\nyour silent protector, a night-light in the gloom.\nOur fates intertwined, two bodies in motion through time and space,\nour dance of devotion.",
+ "If you were my island, then I'd be your sea,\ncaressing your shores, soft and gentle I'd be.\nMy tidal embrace would leave gifts on your sands,\nbut by current and storm, I'd ward your gentle lands.",
+ "If you were love's promise, then I would be time,\nyour constant companion till stars align.\nAnd though we are mere mortals,\ntrue love is divine,and my devotion eternal,\nto my one valentine.",
+ "Have I told you,\nValentine, That I’m all wrapped up in you?\nMy feelings for you bring to me A joy I never knew.\n \n You light up everything for me; In my heart you shine;\nIlluminating my whole life,\nMy darling Valentine.",
+ "My days are filled with yearning;\nMy nights are full of dreams.\nI’m always thinking of you;\nI’m in a trance, it seems.\n\n You’re all I ever wanted;\nI wish you could be mine;\nAnd so I have to ask you: Will you be my Valentine?",
+ "My Valentine, I love just you;\nMy devotion I declare.\nI’ll spend my life looking for ways To show you that I care.\n\nPlease say you feel the same for me;\nSay you’ll be forever mine;\nWe’ll share a life of happiness,\nMy treasured Valentine.",
+ "Every day with you is Valentine's Day, my love.\nEvery day is filled with romance, with love, with sharing and caring.\nEvery day I am reminded how blessed I am to have you as my,\nValentine, my sweetheart, my lover, my friend, my playmate, my companion.\nNo Valentine card, no words at all could express how much I love You,\nhow ecstatic I feel to know that you are mine.\nMy Valentine, every day,\nI'll try to show you that every day I love you more.",
+ "I lucked out when I met you, sweet thing.\nYou've brought richness to each day I exist.\nYou fill my days with the excitement of love,\nAnd you have since the moment we kissed.\nSo I celebrate Valentine's Day with you,\nWith a love that will always stay fresh and new.",
+ "You are my everything, Valentine.\nAs a desert creature longs for water, my thirst for you can never be slaked.\nIn a ho-hum day dragging on, thoughts of you bring excitement, joy and pleasure.\nAs a child opens the birthday gift he most wanted,\nI see everything I want in you.\nYou are my everything, Valentine.",
+ "My love for you is like the raging sea,\nSo powerful and deep it will forever be.\nThrough storm, wind, and heavy rain, It will withstand every pain.\nOur hearts are so pure and love so sweet.\nI love you more with every heartbeat!",
+ "A million stars up in the sky.\nOne shines brighter - I can't deny.\nA love so precious, a love so true,\na love that comes from me to you.\nThe angels sing when you are near.\nWithin your arms I have nothing to fear.\nYou always know just what to say.\nJust talking to you makes my day.\nI love you, honey, with all of my heart.\nTogether forever and never to part.",
+ "What do I do,\nWhen I'm still in love with you?\nYou walked away, Cause you didn't want to stay.\nYou broke my heart, you tore me apart.\nEvery day I wait for you, Telling myself our love was true.\nBut when you don't show, more tears start to flow.\nThat's when I know I have to let go.",
+ "When I say I love you, please believe it's true.\nWhen I say forever, know I'll never leave you.\nWhen I say goodbye, promise me you won't cry,\nBecause the day I'll be saying that will be the day I die.",
+ "Beauty isn't seen by eyes.\nIt's felt by hearts,\nRecognized by souls,\nIn the presence of love.",
+ "L is for \"laughter\" we had along the way.\nO is for \"optimism\" you gave me every day.\nV is for \"value\" of being my best friend.\nE is for \"eternity,\" a love that has no end.",
+ "If roses were red and violets could be blue,\nI'd take us away to a place just for two.\nYou'd see my true colors and all that I felt.\nI'd see that you could love me and nobody else.\nWe'd build ourselves a fortress where we'd run and play.\nYou'd be mine and I'd be yours till our dying day.\nThen I wake and realize you were never here.\nIt's all just my thoughts, my dreams, my hopes...\nBut now it's only tears!"
+
+ ],
+ "valentine_compliments": [
+
+ "To the love of my life. I’m the luckiest person on Earth because I have you! I adore you! You’ve taught me that the best thing to hold onto in life is each other. You are my sweetheart, you are my life, you are my everything.",
+ "It was a million tiny little things that, when you added them all up, they meant we were supposed to be together.",
+ "When you smile, the whole world stops and stares for a while, cause you're amazing, just the way you are.",
+ "Take love, multiply it by infinity and take it to the depths of forever... and you still have only a glimpse of how I feel for you.",
+ "When you kiss me, the world just melts away. When you hold me in your arms, I feel safe. Being in love with you has made me see how wonderful life can be. I love you.",
+ "No matter how dark the days get, you still know how to make me smile. Even after all this time, you still take my breath away.",
+ "I don't know what my future holds, but I know I want you in it. I would travel to the moon and back just to see you smile.",
+ "I may not always say it, but know that with every breath in my body and every beat of my heart I know I will always love you.",
+ "Darling I will be loving you till we're 70. And baby my heart could still fall as hard at 23. And I'm thinking about how people fall in love in mysterious ways. Maybe just the touch of a hand. Oh me, I fall in love with you every single day. And I just wanna tell you I am. So honey now. Take me into your loving arms. Kiss me under the light of a thousand stars. Place your head on my beating heart. I'm thinking out loud. Maybe we found love right where we are.",
+ "I love you. I knew it the minute I met you. I'm sorry it took so long for me to catch up. I just got stuck.",
+ "You are truly beautiful from within. I am serious! It's not just about how pretty you are (which you are, of course), but you have a beautiful heart.",
+ "If you could see yourself through my eyes, you would know how much I love you. You hold a very special place in my heart! I will love you forever!",
+ "I don’t need a thousand reasons to feel special. All I need is you to live in this world. You are the sunshine of my life.",
+ "I wish to be everything that brings a smile on your face and happiness in your heart. I want to love you like no else ever did!",
+ "Every morning of my life gives you a new reason to love you and to appreciate you for what you’ve given me. You are the one that holds the key to my heart!",
+ "Each time I look at you, I just smile to myself and think, ‘I certainly could not have done better’. You are perfect the way you are. I love you honey.",
+ "Look at the computer keyboard, U and I were placed side by side. That’s how the alphabets should be arranged because my love will never cease to exist as long as it’s you and me."
+
+ ]
+
+}
diff --git a/bot/seasons/valentines/be_my_valentine.py b/bot/seasons/valentines/be_my_valentine.py
new file mode 100644
index 00000000..0046ceb4
--- /dev/null
+++ b/bot/seasons/valentines/be_my_valentine.py
@@ -0,0 +1,241 @@
+import logging
+import random
+import typing
+from json import load
+from pathlib import Path
+
+import discord
+from discord.ext import commands
+from discord.ext.commands.cooldowns import BucketType
+
+from bot.constants import Client, Colours, Lovefest
+
+log = logging.getLogger(__name__)
+
+HEART_EMOJIS = [":heart:", ":gift_heart:", ":revolving_hearts:", ":sparkling_heart:", ":two_hearts:"]
+
+
+class BeMyValentine:
+ """
+ A cog that sends valentines to other users !
+ """
+
+ def __init__(self, bot):
+ self.bot = bot
+ self.valentines = self.load_json()
+
+ @staticmethod
+ def load_json():
+ p = Path('bot', 'resources', 'valentines', 'bemyvalentine_valentines.json')
+ with p.open() as json_data:
+ valentines = load(json_data)
+ return valentines
+
+ @commands.group(name="lovefest", invoke_without_command=True)
+ async def lovefest_role(self, ctx):
+ """
+ You can have yourself the lovefest role or remove it.
+ The lovefest role makes you eligible to receive anonymous valentines from other users.
+
+ 1) use the command \".lovefest sub\" to get the lovefest role.
+ 2) use the command \".lovefest unsub\" to get rid of the lovefest role.
+ """
+ await ctx.invoke(self.bot.get_command("help"), "lovefest")
+
+ @lovefest_role.command(name="sub")
+ async def add_role(self, ctx):
+ """
+ This command adds the lovefest role.
+ """
+ user = ctx.author
+ role = discord.utils.get(ctx.guild.roles, id=Lovefest.role_id)
+ if Lovefest.role_id not in [role.id for role in ctx.message.author.roles]:
+ await user.add_roles(role)
+ await ctx.send("The Lovefest role has been added !")
+ else:
+ await ctx.send("You already have the role !")
+
+ @lovefest_role.command(name="unsub")
+ async def remove_role(self, ctx):
+ """
+ This command removes the lovefest role.
+ """
+ user = ctx.author
+ role = discord.utils.get(ctx.guild.roles, id=Lovefest.role_id)
+ if Lovefest.role_id not in [role.id for role in ctx.message.author.roles]:
+ await ctx.send("You dont have the lovefest role.")
+ else:
+ await user.remove_roles(role)
+ await ctx.send("The lovefest role has been successfully removed !")
+
+ @commands.cooldown(1, 1800, BucketType.user)
+ @commands.group(name='bemyvalentine', invoke_without_command=True)
+ async def send_valentine(self, ctx, user: typing.Optional[discord.Member] = None, *, valentine_type=None):
+ """
+ This command sends valentine to user if specified or a random user having lovefest role.
+
+ syntax: .bemyvalentine [user](optional) [p/poem/c/compliment/or you can type your own valentine message]
+ (optional)
+
+ example: .bemyvalentine (sends valentine as a poem or a compliment to a random user)
+ example: .bemyvalentine Iceman#6508 p (sends a poem to Iceman)
+ example: .bemyvalentine Iceman Hey I love you, wanna hang around ? (sends the custom message to Iceman)
+ NOTE : AVOID TAGGING THE USER MOST OF THE TIMES.JUST TRIM THE '@' when using this command.
+ """
+
+ if ctx.guild is None:
+ # This command should only be used in the server
+ msg = "You are supposed to use this command in the server."
+ return await ctx.send(msg)
+
+ if user:
+ if Lovefest.role_id not in [role.id for role in user.roles]:
+ message = f"You cannot send a valentine to {user} as he/she does not have the lovefest role!"
+ return await ctx.send(message)
+
+ if user == ctx.author:
+ # Well a user can't valentine himself/herself.
+ return await ctx.send("Come on dude, you can't send a valentine to yourself :expressionless:")
+
+ emoji_1, emoji_2 = self.random_emoji()
+ lovefest_role = discord.utils.get(ctx.guild.roles, id=Lovefest.role_id)
+ channel = self.bot.get_channel(Lovefest.channel_id)
+ valentine, title = self.valentine_check(valentine_type)
+
+ if user is None:
+ author = ctx.author
+ user = self.random_user(author, lovefest_role.members)
+ if user is None:
+ return await ctx.send("There are no users avilable to whome your valentine can be sent.")
+
+ embed = discord.Embed(
+ title=f'{emoji_1} {title} {user.display_name} {emoji_2}',
+ description=f'{valentine} \n **{emoji_2}From {ctx.author}{emoji_1}**',
+ color=Colours.pink
+ )
+ await channel.send(user.mention, embed=embed)
+
+ @commands.cooldown(1, 1800, BucketType.user)
+ @send_valentine.command(name='secret')
+ async def anonymous(self, ctx, user: typing.Optional[discord.Member] = None, *, valentine_type=None):
+ """
+ This command DMs a valentine to be given anonymous to a user if specified or a random user having lovefest role.
+
+ **This command should be DMed to the bot.**
+
+ syntax : .bemyvalentine secret [user](optional) [p/poem/c/compliment/or you can type your own valentine message]
+ (optional)
+
+ example : .bemyvalentine secret (sends valentine as a poem or a compliment to a random user in DM making you
+ anonymous)
+ example : .bemyvalentine secret Iceman#6508 p (sends a poem to Iceman in DM making you anonymous)
+ example : .bemyvalentine secret Iceman#6508 Hey I love you, wanna hang around ? (sends the custom message to
+ Iceman in DM making you anonymous)
+ """
+
+ if ctx.guild is not None:
+ # This command is only DM specific
+ msg = "You are not supposed to use this command in the server, DM the command to the bot."
+ return await ctx.send(msg)
+
+ if user:
+ if Lovefest.role_id not in [role.id for role in user.roles]:
+ message = f"You cannot send a valentine to {user} as he/she does not have the lovefest role!"
+ return await ctx.send(message)
+
+ if user == ctx.author:
+ # Well a user cant valentine himself/herself.
+ return await ctx.send('Come on dude, you cant send a valentine to yourself :expressionless:')
+
+ guild = self.bot.get_guild(id=Client.guild)
+ emoji_1, emoji_2 = self.random_emoji()
+ lovefest_role = discord.utils.get(guild.roles, id=Lovefest.role_id)
+ valentine, title = self.valentine_check(valentine_type)
+
+ if user is None:
+ author = ctx.author
+ user = self.random_user(author, lovefest_role.members)
+ if user is None:
+ return await ctx.send("There are no users avilable to whome your valentine can be sent.")
+
+ embed = discord.Embed(
+ title=f'{emoji_1}{title} {user.display_name}{emoji_2}',
+ description=f'{valentine} \n **{emoji_2}From anonymous{emoji_1}**',
+ color=Colours.pink
+ )
+ try:
+ await user.send(embed=embed)
+ except discord.Forbidden:
+ await ctx.author.send(f"{user} has DMs disabled, so I couldn't send the message. Sorry!")
+ else:
+ await ctx.author.send(f"Your message has been sent to {user}")
+
+ def valentine_check(self, valentine_type):
+ if valentine_type is None:
+ valentine, title = self.random_valentine()
+
+ elif valentine_type.lower() in ['p', 'poem']:
+ valentine = self.valentine_poem()
+ title = 'A poem dedicated to'
+
+ elif valentine_type.lower() in ['c', 'compliment']:
+ valentine = self.valentine_compliment()
+ title = 'A compliment for'
+
+ else:
+ # in this case, the user decides to type his own valentine.
+ valentine = valentine_type
+ title = 'A message for'
+ return valentine, title
+
+ @staticmethod
+ def random_user(author, members):
+ """
+ Picks a random member from the list provided in `members`, ensuring
+ the author is not one of the options.
+
+ :param author: member who invoked the command
+ :param members: list of discord.Member objects
+ """
+ if author in members:
+ members.remove(author)
+
+ return random.choice(members) if members else None
+
+ @staticmethod
+ def random_emoji():
+ EMOJI_1 = random.choice(HEART_EMOJIS)
+ EMOJI_2 = random.choice(HEART_EMOJIS)
+ return EMOJI_1, EMOJI_2
+
+ def random_valentine(self):
+ """
+ Grabs a random poem or a compliment (any message).
+ """
+ valentine_poem = random.choice(self.valentines['valentine_poems'])
+ valentine_compliment = random.choice(self.valentines['valentine_compliments'])
+ random_valentine = random.choice([valentine_compliment, valentine_poem])
+ if random_valentine == valentine_poem:
+ title = 'A poem dedicated to'
+ else:
+ title = 'A compliment for '
+ return random_valentine, title
+
+ def valentine_poem(self):
+ """
+ Grabs a random poem.
+ """
+ valentine_poem = random.choice(self.valentines['valentine_poems'])
+ return valentine_poem
+
+ def valentine_compliment(self):
+ """
+ Grabs a random compliment.
+ """
+ valentine_compliment = random.choice(self.valentines['valentine_compliments'])
+ return valentine_compliment
+
+
+def setup(bot):
+ bot.add_cog(BeMyValentine(bot))
+ log.debug("Be My Valentine cog loaded")