Skip to content

Commit

Permalink
Merge pull request #62 from EncryptEx/FEAT/Femtolink-metrics-enhancement
Browse files Browse the repository at this point in the history
FEAT: Added femtolink integration to graph images
  • Loading branch information
EncryptEx committed Oct 10, 2023
2 parents 7a22115 + 378b4b9 commit 27885d5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ OWNER=12345
ANNOUNCEMENTS=
SECURITYGUILD=
SECURITY=
BANNEDWORDS=
BANNEDWORDS=
FEMTOLINK=
23 changes: 14 additions & 9 deletions bot.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import base64
import datetime
import json
import os
import sqlite3
import sys
import urllib
from email import message
import requests
from os import listdir
from os.path import isfile
from os.path import join
from pydoc import describe
from time import time

import discord
Expand All @@ -27,6 +24,7 @@
from get_enviroment import SECURITY_CHANNEL
from get_enviroment import SECURITY_GUILD
from get_enviroment import SWEAR_WORDS_LIST
from get_enviroment import FEMTOLINK
from get_enviroment import TOKEN

# Language Loading
Expand Down Expand Up @@ -1650,11 +1648,18 @@ async def metrics(ctx):
if len(uurl) < 2048:
embed.set_image(url=uurl)
else:
rest = uurl
i = 1020
while len(rest) > 0:
await ctx.respond(rest[:i])
rest = rest[i:]
headers = {
'Authorization': f"Bearer {FEMTOLINK}",
'Content-Type': 'application/json',
}

data ='{ "long_url": "' + uurl + '" }'

response = requests.post('https://femtolink.jaumelopez.dev/api/link', headers=headers, data=data)


embed.set_image(url=response.json()['link'])

embed.set_footer(
text=await GetTranslatedText(ctx.guild.id,
"footer_executed_by",
Expand Down
1 change: 1 addition & 0 deletions get_enviroment.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
SECURITY_GUILD = os.getenv("SECURITYGUILD")
SECURITY_CHANNEL = os.getenv("SECURITY")
SWEAR_WORDS_LIST = os.getenv("BANNEDWORDS", "").split(",")
FEMTOLINK = os.getenv("FEMTOLINK", "")

0 comments on commit 27885d5

Please sign in to comment.