Browse Source

disabled upload until that mess can be sorted.

tags/v1.7.0
Roxie Gibson 6 years ago
parent
commit
e32fbb3d6e
3 changed files with 13 additions and 12 deletions
  1. +7
    -2
      README.md
  2. +6
    -8
      Roxbot/cogs/util.py
  3. +0
    -2
      requirements.txt

+ 7
- 2
README.md View File

#### v1.7.0 #### v1.7.0
###### New Features ###### New Features
- NSFW commands now have the same system of preventing dupe outputs - NSFW commands now have the same system of preventing dupe outputs
###### Minor Changes

###### Misc. Changes
- `avatar` now outputs a png if the image is static. - `avatar` now outputs a png if the image is static.
- Moved NSFW commands to use aiohttp instead of requests which hopefully will wield quicker response times.
- EmbedColours are now standardised within RoxBot.
- All of RoxBot's requests are now handled by the http file. All http requests have been moved to aiohttp.
- requests and lxml have been removed as dependencies of Roxbot.
- `upload` has been disabled for the time being until a way for it to work with aiohttp is found.
- Minor refactoring in places, which involves some directory movement. - Minor refactoring in places, which involves some directory movement.

###### Bug Fixes ###### Bug Fixes
- Doubled the amount of times subreddit commands will cycle through possible requests to fix JSON decode error. - Doubled the amount of times subreddit commands will cycle through possible requests to fix JSON decode error.
- Fixed error in reddit cog due to changing JSON outputs thanks to new reddit redesign. - Fixed error in reddit cog due to changing JSON outputs thanks to new reddit redesign.

+ 6
- 8
Roxbot/cogs/util.py View File

import os import os
import random
import discord import discord
import requests
from discord.ext import commands from discord.ext import commands
from discord.ext.commands import bot from discord.ext.commands import bot


embed.add_field(name="Managed", value=str(role.managed), inline=False) embed.add_field(name="Managed", value=str(role.managed), inline=False)
return await ctx.send(embed=embed) return await ctx.send(embed=embed)


@bot.command(enabled=True)
@bot.command(enabled=False)
async def upload(self, ctx): async def upload(self, ctx):
""" """
Uploads selected file to the host, thanks to the fact that Uploads selected file to the host, thanks to the fact that
"https://vidga.me/", "https://vidga.me/",
"https://pomf.pyonpyon.moe/" "https://pomf.pyonpyon.moe/"
] # List of pomf clone sites and upload limits ] # List of pomf clone sites and upload limits
if ctx.message.attachments:
"""if ctx.message.attachments:
# Site choice, shouldn't need an upload size check since max upload for discord atm is 50MB # Site choice, shouldn't need an upload size check since max upload for discord atm is 50MB
site = random.choice(sites) site = random.choice(sites)
urls = [] urls = []
# Download File # Download File
await Roxbot.http.download_file(attachment.url, name) await Roxbot.http.download_file(attachment.url, name)
# Upload file # Upload file
with open(name, 'rb') as f:
answer = requests.post(url=site + "upload.php", files={'files[]': (name, f.read())})
response = answer.json()
#with open(name, 'rb') as f:
# answer = requests.post(url=site + "upload.php", files={'files[]': (name, f.read())})
#response = answer.json()
file_name_1 = response["files"][0]["url"].replace("\\", "") file_name_1 = response["files"][0]["url"].replace("\\", "")
urls.append(file_name_1) urls.append(file_name_1)
os.remove(name) os.remove(name)
msg = "".join(urls) msg = "".join(urls)
return await ctx.send(msg) return await ctx.send(msg)
else: else:
return await ctx.send("Send me stuff to upload.")
return await ctx.send("Send me stuff to upload.")"""


@upload.error @upload.error
async def upload_err(self, ctx, error): async def upload_err(self, ctx, error):

+ 0
- 2
requirements.txt View File

requests==2.18.4
lxml==3.8.0
aiohttp==3.0.1 aiohttp==3.0.1
beautifulsoup4==4.6.0 beautifulsoup4==4.6.0
discord==0.0.2 discord==0.0.2

Loading…
Cancel
Save