async def command(bot, guild, message, command, args): if not ("administrator", True) in message.author.guild_permissions: return datastore = serverdatastore.jsonDatastore prefix = datastore["servers"][f"{guild.id}"]["prefix"] if len(args) == 0: await utils.create_embed("Error.", f"Usage: {prefix}setautorole <@newautorole>", discord.Colour.red(), message.channel) return role_id = args[0].replace("<", "").replace(">", "").replace("@&", "") role = guild.get_role(int(role_id)) if not role: await utils.create_embed("Error.", f"Role not found.", discord.Colour.red(), message.channel) return role_name = role.name datastore["servers"][f"{guild.id}"]["autorole"] = role_name serverdatastore.writeServersJson(datastore) await utils.create_embed( "Success!", f"Successfully changed the server autorole to {role.mention}!", discord.Colour.green(), message.channel)
async def command(bot, guild, message, command, args): if ("administrator", "False") in message.author.guild_permissions: return datastore = serverdatastore.jsonDatastore prefix = datastore["servers"][f"{guild.id}"]["prefix"] if len(args) == 0: embed = discord.Embed( title="Error.", description=f"Usage: {prefix}setprefix <newprefix>", colour=discord.Colour.red()) embed.set_footer(text="Made by the Microbox Team") embed.timestamp = datetime.utcnow() await message.channel.send(embed=embed) return newPrefix = " ".join(args) datastore["servers"][f"{guild.id}"]["prefix"] = newPrefix serverdatastore.writeServersJson(datastore) embed = discord.Embed( title="Success!", description= f"Successfully changed the server prefix from '{prefix}' to '{newPrefix}'.", colour=discord.Colour.green()) embed.set_footer(text="Made by the Microbox Team") embed.timestamp = datetime.utcnow() await message.channel.send(embed=embed)
async def command(bot, guild, message, command, args): if not ("administrator", True) in message.author.guild_permissions: return datastore = serverdatastore.jsonDatastore prefix = datastore["servers"][f"{guild.id}"]["prefix"] if len(args) == 0: await utils.create_embed("Error.", f"Usage: {prefix}setwelcomechannel <#welcome_channel>", discord.Colour.red(), message.channel) return welcome_channel_id = args[0].replace("<", "").replace(">", "").replace("#", "") if not utils.represents_int(welcome_channel_id): await utils.create_embed("Error.", f"Invalid Channel.", discord.Colour.red(), message.channel) return welcome_channel = guild.get_channel(int(welcome_channel_id)) if not welcome_channel: await utils.create_embed("Error.", f"Channel not found.", discord.Colour.red(), message.channel) return channel_name = welcome_channel.name datastore["servers"][f"{guild.id}"]["welcome_channel"] = channel_name serverdatastore.writeServersJson(datastore) await utils.create_embed("Success!", f"Successfully changed the server welcome channel to {welcome_channel.mention}.", discord.Colour.green(), message.channel)
async def command(bot, guild, message, command, args): if not ("administrator", True) in message.author.guild_permissions: return datastore = serverdatastore.jsonDatastore prefix = datastore["servers"][f"{guild.id}"]["prefix"] if len(args) == 0: await utils.create_embed("Error.", f"Usage: {prefix}setprefix <newprefix>", discord.Colour.red(), message.channel) return newPrefix = " ".join(args) datastore["servers"][f"{guild.id}"]["prefix"] = newPrefix serverdatastore.writeServersJson(datastore) await utils.create_embed("Success!", f"Successfully changed the server prefix from '{prefix}' to '{newPrefix}'.", discord.Colour.green(), message.channel)