Update arbitration.py

This commit is contained in:
Emperor 2020-07-10 13:52:47 -04:00
parent a8e70eec24
commit 196fe2e2cd
No known key found for this signature in database
GPG Key ID: 725765E199BB6A5F

View File

@ -37,8 +37,6 @@ async def on_ready():
await bot.change_presence(status=discord.Status.online, activity=discord.Activity(name='Starting up...', type=3)) await bot.change_presence(status=discord.Status.online, activity=discord.Activity(name='Starting up...', type=3))
sched.add_job(arby_post_task, trigger='cron', minute='*', second='20', id='Elite', replace_existing=True) # trigger every minute, works best cus cron sched.add_job(arby_post_task, trigger='cron', minute='*', second='20', id='Elite', replace_existing=True) # trigger every minute, works best cus cron
bot.load_extension("cogs.warframe")
@bot.command(name="reload") @bot.command(name="reload")
@commands.is_owner() @commands.is_owner()
async def reload(ctx, cog): async def reload(ctx, cog):
@ -139,21 +137,35 @@ async def arby_post_task():
try: try:
role = discord.utils.get(guild.roles, name=str(CurrentArbi['solnodedata']['node'])) role = discord.utils.get(guild.roles, name=str(CurrentArbi['solnodedata']['node']))
content+=' '+role.mention content+=' '+role.mention
arb = discord.Embed(title=CurrentArbi['solnodedata']['type'] + " - " + CurrentArbi['solnodedata']['enemy'], ### making discord embed here arb = {
description=CurrentArbi['solnodedata']['node']+' ('+CurrentArbi['solnodedata']['planet']+')\n'+x, "content": content,
colour=discord.Colour(0xf1c40f)) "username": "Arbitration",
"avatar_url": "https://cdn.discordapp.com/avatars/705812867781492777/0f0d8efa6759afa9d2bb2618d59dd306.png?size=128",
"embeds": [{
"title": CurrentArbi['solnodedata']['type'] + " - " + CurrentArbi['solnodedata']['enemy'],
"description": CurrentArbi['solnodedata']['node']+' ('+CurrentArbi['solnodedata']['planet']+')\n'+x,
"color": 15844367,
"thumbnail": {"url": "https://i.imgur.com/2Lyw9yo.png"},
"footer": {"text": CurrentArbi['solnodedata']['tileset']}
}]
}
except: except:
arb = discord.Embed(title=CurrentArbi['solnodedata']['type'] + " - " + CurrentArbi['solnodedata']['enemy'], ### making discord embed here arb = {
description=CurrentArbi['solnodedata']['node']+' ('+CurrentArbi['solnodedata']['planet']+')\n'+x, "content": content,
colour=discord.Colour(0x900f0f)) "username": "Arbitration",
arb.set_thumbnail(url='https://i.imgur.com/2Lyw9yo.png') "avatar_url": "https://cdn.discordapp.com/avatars/705812867781492777/0f0d8efa6759afa9d2bb2618d59dd306.png?size=128",
arb.set_footer(text=CurrentArbi['solnodedata']['tileset']) "embeds": [{
"title": CurrentArbi['solnodedata']['type'] + " - " + CurrentArbi['solnodedata']['enemy'],
"description": CurrentArbi['solnodedata']['node']+' ('+CurrentArbi['solnodedata']['planet']+')\n'+x,
"color": 9441039,
"thumbnail": {"url": "https://i.imgur.com/2Lyw9yo.png"},
"footer": {"text": CurrentArbi['solnodedata']['tileset']}
}]
}
try: try:
async with aiohttp.ClientSession() as session: requests.post(i['arbywebhook'], json=arb)
webhook = Webhook.from_url(i['arbywebhook'], adapter=AsyncWebhookAdapter(session))
await webhook.send(username="Arbitration", avatar_url='https://cdn.discordapp.com/avatars/705812867781492777/0f0d8efa6759afa9d2bb2618d59dd306.png?size=128',content=content, embed=arb) ### sending embed to channel
except: except:
pass return
OldArbi = request_arby() ### setting old arbi to the one that was just posted, so it doesnt send duplicate OldArbi = request_arby() ### setting old arbi to the one that was just posted, so it doesnt send duplicate
@bot.event @bot.event