I am looking for a simple solution that can be used here: This is my code.
import discord
import json
from discord.ext import commands
print("Starting bot...")
TOKEN = ''
client = commands.Bot(command_prefix = '.')
@client.event
async def on_message(message):
embeds = message.embeds
for embed in embeds:
emb = str(embed.to_dict())
if 'owned' in emb:
owned = object('title')
print(owned)
print("Bot is ready!")
client.run(TOKEN)
(I do have a discord bot token in place I removed it to show y'all) Anyways my goal is to be able to take emb, which comes out of the script looking like this:
{'footer': {'text': 'Item Type: Sellable'}, 'thumbnail': {'width': 75, 'url': 'https://cdn.discordapp.com/emojis/714980893999104051.png', 'proxy_url': 'https://images-ext-1.discordapp.net/external/c4teYBjoGAhxnygEZ5F2GlHWzReCIg_xEOX1PPtZdIQ/https/cdn.discordapp.com/emojis/714980893999104051.png', 'height': 75}, 'color': 15684432, 'type': 'rich', 'description': "This item's purpose is to be collected or sold. Nothing more, nothing less.\n\n**BUY** - Not able to be purchased\n**SELL** - ⏣ 1,680 (multiplier included)\n**TRADE** - 2k - 7k", 'title': '**Common Fish** (697 owned)'}
and to be able to take only the last part, the 697. My major problem here is that this will sometimes be 500, sometimes only be 2 but I would like to be able to extract that and use it as a variable. Keep in mind that the length of the lines will vary. Thanks in advance!