def __init__(self, client): self.client = client self.client_color = Color.red() self.color_dict = { 1: [Color.teal(), 'teal'], 2: [Color.dark_teal(), 'dark_teal'], 3: [Color.green(), 'green'], 4: [Color.dark_green(), 'dark_green'], 5: [Color.blue(), 'blue'], 6: [Color.dark_blue(), 'dark_blue'], 7: [Color.purple(), 'purple'], 8: [Color.dark_purple(), 'dark_purple'], 9: [Color.magenta(), 'magenta'], 10: [Color.dark_magenta(), 'dark_magenta'], 11: [Color.gold(), 'gold'], 12: [Color.dark_gold(), 'dark_gold'], 13: [Color.orange(), 'orange'], 14: [Color.dark_orange(), 'dark_orange'], 15: [Color.red(), 'red'], 16: [Color.dark_red(), 'dark_red'], 17: [Color.lighter_grey(), 'lighter_grey'], 18: [Color.dark_grey(), 'grey'], 19: [Color.light_grey(), 'light_grey'], 20: [Color.darker_grey(), 'darker_grey'] }
def random(): # type: () -> Color tan = Color(0xBEAA3E) return choice([ Color.teal(), Color.dark_teal(), Color.green(), Color.dark_green(), Color.blue(), Color.dark_blue(), Color.purple(), Color.dark_purple(), Color.magenta(), Color.dark_magenta(), Color.gold(), Color.dark_gold(), Color.orange(), Color.dark_orange(), Color.red(), Color.dark_red(), Color.lighter_grey(), Color.darker_grey(), Color.blurple(), tan, ])
def random(): # type: () -> Color chilipepper = Color(0x9B1B30) tan = Color(0xBEAA3E) icedcoffee = Color(0xB18F6A) return choice([ Color.teal(), Color.dark_teal(), Color.green(), Color.dark_green(), Color.blue(), Color.dark_blue(), Color.purple(), Color.dark_purple(), Color.magenta(), Color.dark_magenta(), Color.gold(), Color.dark_gold(), Color.orange(), Color.dark_orange(), Color.red(), Color.dark_red(), Color.lighter_grey(), Color.darker_grey(), Color.blurple(), tan, icedcoffee, chilipepper, ])
def random(): c = [ Color.teal(), Color.dark_teal(), Color.green(), Color.dark_green(), Color.blue(), Color.dark_blue(), Color.purple(), Color.dark_purple(), Color.magenta(), Color.dark_magenta(), Color.gold(), Color.dark_gold(), Color.orange(), Color.dark_orange(), Color.red(), Color.dark_red(), Color.lighter_grey(), Color.darker_grey(), Color.blurple(), tan, icedcoffee, chilipepper ] return c[randint(0, len(c) - 1)]
def github_em() -> Embed: return Embed( title=':man_technologist: GitHub', color=Color.darker_grey() ).add_field( name='Link', value='https://github.com/AnonymousX86/poland-bot' )
async def warn(self, ctx: Context, members: Greedy[MentionedMember], *, reason: str): role = get_role(ctx.guild, GuildSetting.WARNING_ROLE) if role is None: role = await ctx.guild.create_role(name="Warning", color=Color.darker_grey()) crud.set_guild_setting(ctx.guild.id, GuildSetting.WARNING_ROLE, role.id) for member in members: await self.moderate( ctx, cb(member.add_roles, role), ModerationType.WARN, reason, member, "📢", )
async def alert_message(title, message, channel, fields=None, color=Color.darker_grey(), details=None): if not channel: pass report_embed = Embed(title=title, color=color, description=message) if fields: for field in fields: report_embed.add_field(name=field['name'], value=field['value'], inline=True) await channel.send(embed=report_embed) if details: await channel.send(details)
async def close(self, ctx, outcome: str = "", *, reason: str = ""): """ Closes a modmail thread. Additional replies will not be sent, and the outcome dealt (unmuted, kicked, etc) Outcomes: unmute, unprobate, kick, ban """ # check if in modmail thread, otherwise complain if ctx.channel.name not in self.modmaillookup: return await ctx.send("This isn't a modmail thread!") # Grab the user by their id, which is in the channel title try: user = self.bot.guild.get_member( int(ctx.channel.name.split("-")[1])) except ValueError: return await ctx.send("This isn't a modmail thread!") if user is None: return await ctx.send("User not found!") # A reason to close is required! if reason == "": return await ctx.send( f"A reason must be provided for the consequence!") if outcome == "unmute": await user.remove_roles(self.bot.muted_role) await self.dm( user, f"You have been unmuted in {self.bot.guild.name}. Understand that next time you may be put on probation." ) emb = Embed(title="User Unmuted (MM)", color=Color.greyple()) emb.add_field(name="Username:"******"{user.name}#{user.discriminator}", inline=True) emb.add_field(name="Member ID:", value=user.id, inline=True) emb.add_field(name="Reason:", value=reason, inline=True) emb.set_thumbnail(url=user.avatar_url) await self.bot.userlogs_channel.send("", embed=emb) elif outcome == "unprobate": await user.remove_roles(self.bot.probated_role) await self.dm( user, f"You have been unprobated in {self.bot.guild.name}. Understand that next time you may be banned outright." ) emb = Embed(title="User Unprobated (MM)", color=Color.darker_grey()) emb.add_field(name="Username:"******"{user.name}#{user.discriminator}", inline=True) emb.add_field(name="Member ID:", value=user.id, inline=True) emb.add_field(name="Reason:", value=reason, inline=True) emb.set_thumbnail(url=user.avatar_url) await self.bot.userlogs_channel.send("", embed=emb) elif outcome == "kick": await self.dm(user, f"You have been kicked from {self.bot.guild.name}.") await user.kick(reason="(MM) - " + reason) elif outcome == "ban": await self.dm(user, f"You have been banned from {self.bot.guild.name}.") await user.ban(delete_message_days=0, reason="(MM) - " + reason) else: return await ctx.send(f"Consequence \"{outcome}\" is not valid!") userthread = f"user-{user.id}" del self.modmaillookup[userthread] await ctx.channel.delete(reason=f"Closed - {outcome}'d - {reason}")