async def autorole(self, ctx, action=None, role:discord.Role=None): if action is None: role_id = db.get_autorole(ctx.guild.id) if role_id is False: return await ctx.send("You don't have any autorole set in this guild.") try: await ctx.guild.fetch_roles() autorole = ctx.guild.get_role(int(role_id)) autorole_e = discord.Embed( title=f"{ctx.guild.name}'s autorole", description="All the new members will get this role when joining.", color=MAINCOLOR ) autorole_e.add_field(name="Role", value=autorole.mention) return await ctx.send(embed=autorole_e) except: return await ctx.send("There is a problem...") if action.lower() == "add": if role is None: return await ctx.send(f"Please provid a role :\n```{ctx.prefix}autorole add <role>```") db.cursor.execute("UPDATE guilds SET autorole_id = ? WHERE guild_id = ?", (role.id, ctx.guild.id)) db.commit() return await ctx.send(f"Autorole : \"{role.name}\" successfully set.") elif action.lower() == "remove": db.cursor.execute("UPDATE guilds SET autorole_id = ? WHERE guild_id = ?", (None, ctx.guild.id)) db.commit() return await ctx.send("You don't have an autorole anymore.") else: return await ctx.send(f"Please provid a valid action :\n```{ctx.prefix}autorole (<action>) (<message>)```")
async def mod_logs(self, ctx, channel: discord.TextChannel = None): if channel is None: channel_id = db.logs_channel(ctx.guild.id) if channel_id is False: return await ctx.send( f"No logs channel set in this guild. Use `{ctx.prefix}mod-logs <#channel>` to set one." ) return await ctx.send( f"Current logs channel on this guild : <#{channel_id}>\nUse `{ctx.prefix}mod-logs remove` to remove the actual one" ) db.is_in_database_guild(ctx.guild.id) db.cursor.execute("UPDATE guilds SET logs_id = ? WHERE guild_id = ?", (channel.id, ctx.guild.id)) db.commit() await ctx.send(f"New mod channel will be {channel.mention}")
async def welcome_message(self, ctx, action=None, *, message=None): if action is None and message is None: return await ctx.send(f"Please provid all require parameters :\n```{ctx.prefix}welcome-message <action> <message>```\n(Notice that <message> depends of your action)") db.is_in_database_guild(ctx.guild.id) if action.lower() == "add": if message is None: return await ctx.send(f"Please provid a message :\n```{ctx.prefix}welcome-message add <message>```") db.cursor.execute("UPDATE guilds SET welcome_message = ? WHERE guild_id = ?", (message, ctx.guild.id)) db.commit() return await ctx.send(f"Welcome message : \"{message}\" successfully set.") elif action.lower() == "remove": db.cursor.execute("UPDATE guilds SET welcome_message = ? WHERE guild_id = ?", (None, ctx.guild.id)) db.commit() return await ctx.send("You don't have a welcome message anymore.") else: return await ctx.send(f"Please provid a valid action :\n```{ctx.prefix}welcome-message <action> (<message>)```")
async def welcome_channel(self, ctx, action=None, channel:discord.TextChannel=None): if action is None and channel is None: return await ctx.send(f"Please provid all require parameters :\n```{ctx.prefix}welcome-channel <action> <channel>```\n(Notice that <channel> depends of your action)") db.is_in_database_guild(ctx.guild.id) if action.lower() == "add": if channel is None: return await ctx.send(f"Please provid a valid channel :\n```{ctx.prefix}welcome-channel add <channel>```") db.cursor.execute("UPDATE guilds SET welcome_id = ? WHERE guild_id = ?", (channel.id, ctx.guild.id)) db.commit() return await ctx.send(f"Welcome channel {channel.mention} successfully set.") elif action.lower() == "remove": db.cursor.execute("UPDATE guilds SET welcome_id = ? WHERE guild_id = ?", (None, ctx.guild.id)) db.commit() return await ctx.send("You don't have a welcome channel anymore.") else: return await ctx.send(f"Please provid a valid action :\n```{ctx.prefix}welcome-channel <action> (<channel>)```")
async def remove(self, ctx): db.is_in_database_guild(ctx.guild.id) db.cursor.execute("UPDATE guilds SET logs_id = ? WHERE guild_id = ?", (None, ctx.guild.id)) db.commit() await ctx.send(f"No more logs channel set on this guild.")