@@ -44,7 +44,7 @@ async def lovefest_role(self, ctx: commands.Context) -> None:
44
44
# @commands.cooldown(1, 1800, commands.BucketType.user)
45
45
@commands .group (name = "bemyvalentine" , invoke_without_command = True )
46
46
async def send_valentine (
47
- self , ctx : commands .Context , user : discord .Member , privacy_type : str | None = None , valentine_type : str | None = None
47
+ self , ctx : commands .Context , user : discord .Member , privacy_type : str | None = None , anon : str | None = None , valentine_type : str | None = None
48
48
) -> None :
49
49
"""
50
50
Send a valentine to a specified user with the lovefest role.
@@ -56,6 +56,24 @@ async def send_valentine(
56
56
example: .bemyvalentine public Iceman Hey I love you, wanna hang around ? (sends the custom message publicly to Iceman)
57
57
NOTE : AVOID TAGGING THE USER MOST OF THE TIMES.JUST TRIM THE '@' when using this command.
58
58
"""
59
+
60
+
61
+ if anon .lower () == "anon" :
62
+ # Delete the message containing the command right after it was sent to enforce anonymity.
63
+ try :
64
+ await ctx .message .delete ()
65
+ except discord .Forbidden :
66
+ await ctx .send ("I can't delete your message! Please check my permissions." )
67
+
68
+
69
+ if anon not in ["anon" , "signed" ]:
70
+ # Anonymity type wrongfully specified.
71
+ raise commands .UserInputError (
72
+ f"Specify if you want the message to be anonymous or not!"
73
+ )
74
+
75
+
76
+
59
77
if ctx .guild is None :
60
78
# This command should only be used in the server
61
79
raise commands .UserInputError ("You are supposed to use this command in the server." )
@@ -81,17 +99,25 @@ async def send_valentine(
81
99
channel = self .bot .get_channel (Channels .sir_lancebot_playground )
82
100
valentine , title = self .valentine_check (valentine_type )
83
101
84
- embed = discord .Embed (
85
- title = f"{ emoji_1 } { title } { user .display_name } { emoji_2 } " ,
86
- description = f"{ valentine } \n **{ emoji_2 } From { ctx .author } { emoji_1 } **" ,
87
- color = Colours .pink
88
- )
89
-
102
+ if anon .lower () == "anon" :
103
+ embed = discord .Embed (
104
+ title = f"{ emoji_1 } { title } { user .display_name } { emoji_2 } " ,
105
+ description = f"{ valentine } \n **{ emoji_2 } From an anonymous admirer{ emoji_1 } **" ,
106
+ color = Colours .pink
107
+ )
108
+
109
+ else :
110
+ embed = discord .Embed (
111
+ title = f"{ emoji_1 } { title } { user .display_name } { emoji_2 } " ,
112
+ description = f"{ valentine } \n **{ emoji_2 } From { ctx .author } { emoji_1 } **" ,
113
+ color = Colours .pink
114
+ )
115
+
90
116
if privacy_type .lower () == "private" :
91
117
# Send the message privately if "private" was speicified
92
118
try :
93
119
await user .send (embed = embed )
94
- await user .send (f"Your valentine has been **privately** delivered to { user .display_name } !" )
120
+ await ctx . author .send (f"Your valentine has been **privately** delivered to { user .display_name } !" )
95
121
except discord .Forbidden :
96
122
await ctx .send (f"I couldn't send a private message to { user .display_name } . They may have DMs disabled." )
97
123
else :
0 commit comments