33import asyncio
44import random
55from ruamel .yaml import YAML
6+ from datetime import datetime
67
78yaml = YAML ()
89
1213client = commands .Bot (command_prefix = config ['prefix' ], intents = discord .Intents .all (), case_insensitive = True )
1314
1415
16+ def __init__ (self ):
17+ self .bot = discord .Client
18+
19+
20+ @client .event
21+ async def on_ready ():
22+ print ('------' )
23+ print ('Logged in as:' )
24+ print (client .user .name )
25+ print (client .user .id )
26+ print ('------' )
27+
28+
1529def convert (time ):
1630 pos = ["s" , "m" , "h" , "d" ]
1731 time_dict = {"s" : 1 , "m" : 60 , "h" : 3600 , "d" : 3600 * 24 }
@@ -70,7 +84,7 @@ def check(m):
7084 await ctx .send (embed = embed )
7185 return
7286 elif time == - 2 :
73- mbed = discord .Embed (title = ":tada: **Giveaway Setup Wizard**" , description = ":x: Time unit **must** be an integer" )
87+ embed = discord .Embed (title = ":tada: **Giveaway Setup Wizard**" , description = ":x: Time unit **must** be an integer" )
7488 await ctx .send (embed = embed )
7589 return
7690 prize = answers [2 ]
@@ -80,16 +94,17 @@ def check(m):
8094 embed .add_field (name = "Time:" , value = f"{ answers [1 ]} " )
8195 await ctx .send (embed = embed )
8296
83- embed = discord .Embed (title = ":tada: **GIVEAWAY**" )
84- embed .add_field (name = "Prize" , value = prize )
85- embed .add_field (name = "Ends In:" , value = answers [1 ])
97+ embed = discord .Embed (title = f":tada: **GIVEAWAY FOR: { prize } **" , description = "React to enter this giveaway!" )
98+ embed .add_field (name = "Lasts:" , value = answers [1 ])
99+ embed .add_field (name = f"Hosted By:" , value = ctx .author .mention )
100+ embed .set_footer (text = f"{ datetime .now ()} " )
86101 msg = await channel .send (embed = embed )
87102
88103 await msg .add_reaction ("🎉" )
89104 await asyncio .sleep (time )
90105
91- msg = await ctx . channel .fetch_message (msg .id )
92- users = await msg .reactions [0 ].users ().flatten ()
106+ new_msg = await channel .fetch_message (msg .id )
107+ users = await new_msg .reactions [0 ].users ().flatten ()
93108 users .pop (users .index (client .user ))
94109
95110 winner = random .choice (users )
@@ -99,19 +114,19 @@ def check(m):
99114
100115@client .command ()
101116@commands .has_role (config ['giveaway_role' ])
102- async def reroll (ctx , channel : discord .TextChannel , id_ : int ):
117+ async def reroll (ctx , channel : discord .TextChannel , id_ : int ):
103118 try :
104- msg = await channel .fetch_message (id_ )
119+ new_msg = await channel .fetch_message (id_ )
105120 except :
106121 prefix = config ['prefix' ]
107- await ctx .send (f"Incorrect usage! Do: `{ prefix } reroll <Channel Name. Example: #general / general > <Giveaway messageID>` " )
122+ await ctx .send (f"Incorrect usage! Do: `{ prefix } reroll <Channel Name - Must be the channel which previously held the giveaway > <messageID of the giveaway message >` " )
108123
109- users = await msg .reactions [0 ].users ().flatten ()
124+ users = await new_msg .reactions [0 ].users ().flatten ()
110125 users .pop (users .index (client .user ))
111126
112127 winner = random .choice (users )
113128
114- await channel .send (f":tada: Congratulations! { winner .mention } won !" )
129+ await ctx . channel .send (f":tada: Congratulations! The new winner is: { winner .mention } !" )
115130
116131
117132client .run (config ['token' ])
0 commit comments