Skip to content

Commit 2abddb1

Browse files
whopiyushkyb3r
authored andcommitted
Custom Haste Support (#195)
* Add Custom Hastebin Support * ENV For Heroku
1 parent e48734c commit 2abddb1

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

app.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
"LOG_URL": {
2727
"description": "The url of the log viewer app for viewing self-hosted logs.",
2828
"required": true
29+
},
30+
"HASTE_URL": {
31+
"description": "If You Have Your Own Self Hosted Hastebin then give the link here.",
32+
"required": false
2933
}
3034
}
3135
}

cogs/utility.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,18 +293,21 @@ async def debug(self, ctx):
293293
@trigger_typing
294294
async def hastebin(self, ctx):
295295
"""Upload logs to hastebin."""
296+
297+
haste_url = os.environ.get('HASTE_URL', 'https://hasteb.in')
298+
296299
with open(os.path.join(os.path.dirname(os.path.abspath(__file__)),
297300
'../temp/logs.log'), 'r+') as f:
298301
logs = f.read().strip()
299302

300303
try:
301-
async with self.bot.session.post('https://hasteb.in/documents',
304+
async with self.bot.session.post(haste_url + '/documents',
302305
data=logs) as resp:
303306
key = (await resp.json())["key"]
304307
embed = Embed(
305308
title='Debug Logs',
306309
color=self.bot.main_color,
307-
description=f'https://hasteb.in/' + key
310+
description=f'{haste_url}/' + key
308311
)
309312
except (JSONDecodeError, ClientResponseError, IndexError):
310313
embed = Embed(

0 commit comments

Comments
 (0)