Bugfix: WillieTimer
This commit is contained in:
@@ -101,7 +101,8 @@ class WillieTimer(commands.Cog):
|
||||
@commands.command(help='Test random choice')
|
||||
async def test_rchoice(self, ctx, *, member: discord.Member = None):
|
||||
member = member or ctx.author.display_name
|
||||
await ctx.send(f"Selection:\t{str(self.get_output_string())}", tts=True)
|
||||
strings_dict = self.get_output_string()
|
||||
await ctx.send(f"420:\t{strings_dict['420']}\nWarning:\t{strings_dict['warm up']}", tts=True)
|
||||
|
||||
def bot_get_role(self):
|
||||
channel = self.bot.get_channel(id=self.channel_id)
|
||||
@@ -109,6 +110,18 @@ class WillieTimer(commands.Cog):
|
||||
role = discord.utils.get(guild.roles, name=self.mention_group)
|
||||
return role
|
||||
|
||||
def bot_get_user(self, input_user=None):
|
||||
if self.caller_name is not None:
|
||||
channel = self.bot.get_channel(id=self.channel_id)
|
||||
guild = channel.guild
|
||||
user = discord.utils.get(guild.member, name=self.caller_name)
|
||||
return user
|
||||
elif input_user is not None:
|
||||
channel = self.bot.get_channel(id=self.channel_id)
|
||||
guild = channel.guild
|
||||
user = discord.utils.get(guild.member, name=input_user)
|
||||
return user
|
||||
|
||||
def get_random_420_phrase(self):
|
||||
selected_phrase = None
|
||||
while not selected_phrase:
|
||||
@@ -142,12 +155,12 @@ class WillieTimer(commands.Cog):
|
||||
|
||||
def get_output_string(self):
|
||||
|
||||
willie_time_string = f"<@&{self.caller_name.id if self.caller_name is not None else ''}>, " \
|
||||
willie_time_string = f"<@&{self.bot_get_user().id if self.caller_name is not None else ''}>, " \
|
||||
f"Willie wanted me to tell you:\n" \
|
||||
f"\"{self.get_random_420_phrase()}\"\n" \
|
||||
f"<@&{self.bot_get_role().id}>"
|
||||
|
||||
warm_up_string = f"<@&{str(self.caller_name.id + ' & ') if self.caller_name is not None else ''}>" \
|
||||
warm_up_string = f"<@&{str(self.bot_get_user().id + ' & ') if self.caller_name is not None else ''}>" \
|
||||
f"<@&{self.bot_get_role().id}>! Heads up! " \
|
||||
f"Willie's passing an early message along:\n" \
|
||||
f"\"{self.get_random_warm_up_phrase()}\""
|
||||
|
||||
Reference in New Issue
Block a user