async def on_message(message): if message.author.id != 835251884104482907: #not from sobbot coin.messageBonus( message.author.id) #check droprate for passive coin earning #special interactions if message.content == "Jenna": # force sentence case # jenna easter egg hi jenna with open("bot/resources/images/misc/jenna.jpeg", "rb") as f: picture = discord.File(f) await message.channel.send("Jenna", file=picture) if message.content == "hello sobbot": await message.channel.send("hi :pleading_face:") return True if match("<@!?835251884104482907>", message.content) is not None: #matches "@sobbot" exactly px = admin.getGuildPrefix(message.guild.id) await message.channel.send( f"My current prefix in this server is `{px}`.\n" + f"Use `{px}help` for a directory of valid commands! :blue_heart:" ) return True #special channels if message.channel.id == 835388133959794699: content = sob.parseMath(message.content) if content != None: await message.channel.send(content) return True await bot.process_commands(message) return True
def getMainHelpDirectory(message): title = "Sobbot - Command Directory" px = admin.getGuildPrefix(message.guild.id) description = "*Enter one of the following commands to view a help subdirectory.*\n\n" for catName, cat in helpData.items(): description += f"•`{px}help {catName}` - {cat['desc']} :{cat['emoji']}:\n" return discord.Embed(title=title, description=description, color=helpfulGreen)
def getSingleList(message): pf = admin.getGuildPrefix(message.guild.id) helpEmbed = discord.Embed() helpEmbed.title = "Available Info Blurbs" text = f"Use one of the commands below to learn more!\n\n" for topic in helpSingles: text += f"`{pf}info {topic}`\n" text += f"`{pf}about`\n" helpEmbed.description = text helpEmbed.color = helpfulGreen return helpEmbed
def getHelpDirectoryEmbed(message, topic): data = getHelpDirectory(topic) if data == None: return None title = f"Sobbot - {data['title']} Command Directory" description = "" px = admin.getGuildPrefix(message.guild.id) if "header" in data: if data["header"] != "": # needs to be a successive check description += f"*{data['header']}*\n\n" for command in data["commands"]: description += f"• {px}{command['usage']} - {command['description']}\n" return discord.Embed(title=title, description=description, color=helpfulGreen)
def getShop(message): #CAREFUL, this is gonna get hard to maintain if there are too many items #pagination? embed = discord.Embed(title="Sobble Shop", color=0xf42069) shopDescription = "" for i in range(1, len(shop)+1): n = str(i) px = admin.getGuildPrefix(message) shopDescription += f"**{shop[n]['name']}** ({px}buy {shop[n]['id']}) " if "limited" in shop[n]: shopDescription += f"`Limited item.`" shopDescription += "\n" shopDescription += f"Price - {shop[n]['price']} soblecoins\n" shopDescription += f"*{shop[n]['description']}*\n" if "prereq" in shop[n]: shopDescription += f"`Requires {shop[shop[n]['prereq']]['name']}.`\n" shopDescription += "\n" embed.description = shopDescription return embed
async def prefix(message, newPrefix): id = message.guild.id if newPrefix == "" or newPrefix == None: ok = admin.resetGuildPrefix(id) if ok == "ok": await message.channel.send( f"Prefix reset to `{admin.getGuildPrefix(id)}`!") elif ok == "nop": await message.channel.send( f"This server is already using the default prefix (`{admin.getGuildPrefix(id)}`)!" ) elif ok == "error": await message.channel.send("Something went wrong.") return True ok = admin.updateGuildPrefix(id, newPrefix) if ok: if newPrefix == admin.getGuildPrefix(id): await message.channel.send(f"Server prefix is now `{newPrefix}`!") return True await message.channel.send( f"Something went wrong. Server prefix unchanged.") return True