async def kuwo(ctx): db.increase_stat(ctx.author.id, "owo") dialogue = random.choice([ "yes :3", "hmm owo", "indeed >\\<", "i see uwu", "ooookayyy owo", "wwwait what", "uuuuuuuh..", "shut up baka" ]) await ctx.channel.send(dialogue) return True
async def on_message(self, ctx): currMessage = ctx.content did_talk = False # Flag to check if the author talked with kuro bot if ctx.author.id != BOT_ID: if ctx.guild is None: self.debugging_logs(ctx) did_talk = True did_talk = await r.match_message(ctx, currMessage) await self.handle_pings(ctx) if did_talk: db.increase_stat(ctx.author.id, "times_talked") await r.check_prev_msg(ctx)
async def stats(self, ctx, *msgs): """will return stats you have with Kuro Bot""" db.increase_stat(ctx.author.id, "checked_stats") def stat_to_text(stat, value, author_id): stat_to_string = { "times_talked": f"You've talked to me {value} times", "owo": f"you hwave owo'd mwe {value} twimes uwu", "quote": f"You have asked for a quote {value} times", "checked_stats": f"You have checked our stats {value} times", "pinged_kuro": f"You have pinged kuro {value} times", } if stat not in stat_to_string: return f"{stat}: {value}" elif author_id == "109590357276098560" and stat == "times_talked": return f"You have talked to yourself {value} times" else: return stat_to_string[stat] with open("stats.json", "r") as stats: stats_obj = json.load(stats) author = str(ctx.author.id) # author_name = discord.get_user(author) author_stats = "" if author not in stats_obj: author_stats = "You haven't talked to me recently" else: for key in stats_obj[author]: author_stats += f"{stat_to_text(key, stats_obj[author][key], author)}\n" embeded = discord.Embed(title="Here are your stats with me!", description=author_stats, color=0x00ff00) embeded.set_thumbnail( url= "https://cdn.discordapp.com/icons/704320774734872577/ce8bfd35ce8598e5792533b1a45c875c.png?size=128" ) await ctx.send(embed=embeded)
async def handle_pings(self, ctx): # Check if people have pinged kuro for user in ctx.mentions: if user.id == BOT_ID or user.id == KURO_ID: db.increase_stat(ctx.author.id, "pinged_kuro") await ctx.channel.send("<:yesdaddy:719927492890198087>")
async def quote(self, ctx, *args): """will send a random quote or the desired quote back""" db.increase_stat(ctx.author.id, "quote") parsed_quote = get_quote(args) for q in parsed_quote: await ctx.send(q)