Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update #2

Merged
merged 110 commits into from
Nov 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
b108573
Update clashroyale.py
ravener Nov 7, 2017
5f810e5
Update clashroyale.py
ravener Nov 7, 2017
b863a0c
Update clashroyale.py
ravener Nov 7, 2017
a5120b5
Update clashroyale.py
ravener Nov 7, 2017
86c7b4f
Update clashroyale.py
ravener Nov 7, 2017
c830540
Update clashroyale.py
ravener Nov 7, 2017
46a4fbf
Forgot a quote lol
ravener Nov 7, 2017
e92fcd9
Update clashroyale.py
ravener Nov 7, 2017
c804ff2
Update clashroyale.py
ravener Nov 7, 2017
c0cb755
Update clashroyale.py
ravener Nov 7, 2017
e8b2462
Update clashroyale.py
ravener Nov 7, 2017
45b9528
Thumbnail and xp
ravener Nov 7, 2017
b102827
Update clashroyale.py
ravener Nov 7, 2017
7a8ab77
Update clashroyale.py
ravener Nov 7, 2017
51c6965
Update clashroyale.py
ravener Nov 7, 2017
7c02ae4
Update clashroyale.py
ravener Nov 7, 2017
697dca7
Update clashroyale.py
ravener Nov 7, 2017
681ede5
Update clashroyale.py
ravener Nov 8, 2017
7517dd3
Update clashroyale.py
ravener Nov 8, 2017
dfb853a
Update clashroyale.py
ravener Nov 8, 2017
7442b96
Update clashroyale.py
ravener Nov 8, 2017
29f36ef
Update clashroyale.py
ravener Nov 8, 2017
231048b
Update clashroyale.py
ravener Nov 8, 2017
e3aea38
Added Win streak
ravener Nov 13, 2017
28d5f38
Added Legend Trophies
ravener Nov 13, 2017
a0adcac
First time trying to do Footer
ravener Nov 13, 2017
e37e274
Update clashroyale.py
ravener Nov 13, 2017
86b2b4b
Footer icon
ravener Nov 13, 2017
26446b8
Update clashroyale.py
ravener Nov 13, 2017
3f2db66
Update clashroyale.py
ravener Nov 13, 2017
beee162
Clash Royale Cog
ravener Nov 13, 2017
699c809
Merge pull request #1 from verixx/rewrite
SharpBit Nov 14, 2017
8439543
Merge pull request #1 from verixx/rewrite
ravener Nov 14, 2017
d41c298
Merge pull request #2 from verixx/rewrite
ravener Nov 14, 2017
31a9fe1
New Custom Command: hi/await ctx.send("Hey")
ravener Nov 14, 2017
a420d59
Cleaned
ravener Nov 14, 2017
1be0c4d
New Custom Command: test/lol
ravener Nov 14, 2017
90174a0
Updating Bot
SharpBit Nov 15, 2017
3f53fd4
@XAOS1502's #175 #176
fourjr Nov 15, 2017
170dc87
Fix cc
fourjr Nov 15, 2017
29e2b5a
Okay
XAOS1502 Nov 15, 2017
fa927f3
Merge pull request #178 from XAOS1502/patch-1
fourjr Nov 15, 2017
b135ffa
Updating Bot
SharpBit Nov 15, 2017
1be2502
Update cc.json
ravener Nov 15, 2017
e397f5b
To load nsfw cog
XAOS1502 Nov 15, 2017
4cbbe01
remove nsfw from load example
fourjr Nov 15, 2017
f173732
Merge branch 'rewrite' into rewrite
fourjr Nov 15, 2017
324b839
k3k
XAOS1502 Nov 15, 2017
28604ac
Need that as well
XAOS1502 Nov 15, 2017
343d9f3
Merge pull request #179 from XAOS1502/patch-2
fourjr Nov 15, 2017
c663c6a
In case it is needed
XAOS1502 Nov 15, 2017
128fc0e
Merge pull request #180 from XAOS1502/patch-3
fourjr Nov 15, 2017
e99f8f0
Added load & reload commands to use nsfw cog after starring main repo
XAOS1502 Nov 15, 2017
2da5e46
Shift options to options.json, clean up list commands
fourjr Nov 15, 2017
5f00fc1
Merge branch 'rewrite' of https://github.com/verixx/selfbot.py into r…
fourjr Nov 15, 2017
1d4fcd1
add json back to gitignore
fourjr Nov 15, 2017
b00bcd9
Fix for https://github.com/verixx/selfbot.py/commit/2da5e46976af159e8…
fourjr Nov 15, 2017
79191bd
Missed out one line
fourjr Nov 15, 2017
942247a
Whole ton of optimisation + fixing "undefined" bugs
fourjr Nov 15, 2017
1a61cec
Auth all requests
fourjr Nov 15, 2017
163ebda
Updating Bot
SharpBit Nov 15, 2017
72771e3
Update option: CR_TAG
SharpBit Nov 15, 2017
a04679e
New text Command: self
SharpBit Nov 15, 2017
af6f065
Deleted text Command: self
SharpBit Nov 15, 2017
ea10ca6
New text Command: selfstats
SharpBit Nov 15, 2017
533b561
Removed, for good
XAOS1502 Nov 15, 2017
fef3f21
Merge pull request #182 from XAOS1502/patch-2
fourjr Nov 15, 2017
494ea95
Merge pull request #181 from XAOS1502/patch-1
fourjr Nov 15, 2017
e334bc3
Fix pycc
fourjr Nov 15, 2017
add5ee2
Merge branch 'rewrite' of https://github.com/verixx/selfbot.py into r…
fourjr Nov 15, 2017
3b74c48
Cleaned up a bit
Nov 15, 2017
be24d70
Merge branch 'rewrite' into patch-1
Nov 15, 2017
ca48057
Merge pull request #161 from freetnt5852/patch-1
Nov 15, 2017
f9b3e2c
docstrings for options
fourjr Nov 15, 2017
f0fe8b7
Merge branch 'rewrite' of https://github.com/verixx/selfbot.py into r…
fourjr Nov 15, 2017
1a9d848
Should have fixed the issue
fourjr Nov 15, 2017
61077cb
fix the 'auto correct' bug
fourjr Nov 15, 2017
d3ba682
strip pycc from edit to codeblock
fourjr Nov 15, 2017
fd4baf7
make a cc wipe
fourjr Nov 15, 2017
2e7b7a2
fix agreecheck
fourjr Nov 15, 2017
2a35755
finally fix agreecheck
fourjr Nov 15, 2017
5821c90
delete the messages
fourjr Nov 15, 2017
23e8be7
add docstring
fourjr Nov 15, 2017
0775aec
Merge pull request #2 from verixx/rewrite
SharpBit Nov 15, 2017
a88fcc4
Add gif cmd
SharpBit Nov 15, 2017
faa1fb2
Update requirements.txt
SharpBit Nov 15, 2017
4fb5205
Update misc.py
SharpBit Nov 15, 2017
69ec5bb
Merge pull request #188 from SharpBit/rewrite
fourjr Nov 15, 2017
f27d83d
Revert "Gif command"
fourjr Nov 15, 2017
557fbb1
Merge pull request #189 from verixx/revert-188-rewrite
fourjr Nov 15, 2017
ec7cefc
Update misc.py
SharpBit Nov 15, 2017
ca4829f
Merge pull request #190 from SharpBit/patch-1
fourjr Nov 15, 2017
1d07472
#190
fourjr Nov 15, 2017
51a7030
More nsfw
XAOS1502 Nov 15, 2017
dc1efe0
Update nsfw.py
XAOS1502 Nov 15, 2017
72d2a56
Added a few more
XAOS1502 Nov 15, 2017
a5fb15d
Merge pull request #197 from XAOS1502/patch-1
Nov 15, 2017
b998c6b
Updated list
XAOS1502 Nov 15, 2017
4b9db59
Merge pull request #198 from XAOS1502/patch-2
Nov 15, 2017
04870e8
Docstrings and tags for gif
XAOS1502 Nov 15, 2017
3692cc4
Merge pull request #200 from XAOS1502/patch-4
Nov 15, 2017
7b69812
How did I miss those?
XAOS1502 Nov 15, 2017
d9cb9b5
Merge pull request #201 from XAOS1502/patch-5
Nov 15, 2017
caaed4f
Merge pull request #193 from XAOS1502/rewrite
fourjr Nov 16, 2017
f7792f7
Delete newgif.py
fourjr Nov 16, 2017
b12fd29
Fix up your filter for gifs
fourjr Nov 16, 2017
a139507
nsfw.json
fourjr Nov 16, 2017
b77c615
Fix embed desc for presence
fourjr Nov 16, 2017
78169c0
close #194
fourjr Nov 16, 2017
7484753
close #187
fourjr Nov 16, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@ __pycache__/
*.py[cod]
*$py.class
*.DS_Store
*.json
cogs/testsplit.py
data/community_cogs.txt
data/community_cogs.txt
44 changes: 26 additions & 18 deletions cogs/community/clashroyale.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
'''
MIT License

Copyright (c) 2017 Grok

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand All @@ -34,42 +30,54 @@ class ClashRoyale:

def __init__(self, bot):
self.bot = bot
with open('data/config.json') as f:
config = json.load(f)
if 'CR_TAG' not in config:
tag = None
with open('data/options.json') as f:
options = json.load(f)
if 'CR_TAG' not in options:
self.tag = None
else:
tag = config['CR_TAG']
self.tag = os.environ.get('CR_TAG') or tag
self.tag = options['CR_TAG']
self.client = crasync.Client()


@commands.command()
async def profile(self, ctx, tag=None):
'''Fetch a Clash Royale Profile!'''
em = discord.Embed(title="Profile")
em.color = await ctx.get_dominant_color(ctx.author.avatar_url)
if tag == None:
if tag is None and self.tag is None:
em.description = "Please add `CR_TAG` to your options. Do `{p}options edit cr_tag <tag>`"
return await ctx.send(embed=em)
elif self.tag is not None:
tag = self.tag
if tag == None:
em.description = "Please add `CR_TAG` to your config."
return await ctx.send(embed=em)

tag = tag.strip('#').replace('O', '0')
try:
profile = await self.client.get_profile(tag)
except:
em.description = "Either API is down or that's an invalid tag."
return await ctx.send(embed=em)

em.title = profile.name
em.set_thumbnail(url=profile.arena.image_url)
em.description = f"#{tag}"
em.url = f"http://cr-api.com/profile/{tag}"
em.add_field(name='Current Trophies', value=profile.current_trophies)
em.add_field(name='Highest Trophies', value=profile.highest_trophies)
em.add_field(name='Legend Trophies', value=f'{profile.legend_trophies}')
em.add_field(name='Level', value=profile.level)
em.add_field(name='Experience', value=f"{profile.experience[0]}/{profile.experience[1]}")
em.add_field(name='Wins/Losses/Draws', value=f'{profile.wins}/{profile.losses}/{profile.draws}')
em.add_field(name='Global Rank', value=f'{profile.global_rank}')
em.add_field(name='Clan Info', value=f'{profile.clan_name}\n#{profile.clan_tag}\n{profile.clan_role}')
em.add_field(name='Win Streak', value=f'{profile.win_streak}')
em.set_footer(text="Powered By cr-api.com", icon_url="http://cr-api.com/static/img/branding/cr-api-logo.png")

try:
em.set_author(name="Profile", icon_url=profile.clan_badge_url)
except:
em.set_author(name='Profile')

await ctx.send(embed=em)


def setup(bot):
bot.add_cog(ClashRoyale(bot))
bot.add_cog(ClashRoyale(bot))
147 changes: 147 additions & 0 deletions cogs/community/nsfw.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
"""
MIT License

Copyright (c) 2017 Grok's naughty dev XAOS

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""

import discord
from discord.ext import commands
import bs4 as bs
import urllib.request
from bs4 import BeautifulSoup
from urllib.request import Request, urlopen
import json
import io
import safygiphy
from ext import embed2box

class Nsfw:
""" Nsfw commands """
def __init__(self, bot):
self.bot = bot

async def __local_check(self, ctx):
if not ctx.channel.is_nsfw():
return False
git = self.bot.get_cog('Git')
if not await git.starred('verixx/selfbot.py'):
return False
return True

@commands.group(invoke_without_command=True)
async def nsfw(self, ctx):
""" Get random lewds from the web """
pass

@nsfw.command()
async def xbooru(self, ctx):
""" Random image from Xbooru """
try:
try:
await ctx.message.delete()
except discord.Forbidden:
pass
await ctx.channel.trigger_typing()
query = urllib.request.urlopen("http://xbooru.com/index.php?page=post&s=random").read()
soup = bs.BeautifulSoup(query, 'html.parser')
image = soup.find(id="image").get("src")
last = str(image.split('?')[-2]).replace('//', '/').replace(':/', '://')
em = discord.Embed(colour=discord.Colour(0xed791d))
em.description = f'[Full Size Link*]({last})'
em.set_image(url=last)
em.set_footer(text='* click link at your own risk!')
try:
await ctx.send(embed=em)
except discord.HTTPException:
await ctx.send('Unable to send embeds here!')
try:
async with ctx.session.get(image) as resp:
image = await resp.read()
with io.BytesIO(image) as file:
await ctx.send(file=discord.File(file, 'xbooru.png'))
except discord.HTTPException:
await ctx.send(image)

except Exception as e:
await ctx.send(f'```{e}```')

@commands.command(aliases=['gelbooru'])
async def gel(self, ctx):
""" Random image from Gelbooru """
try:
try:
await ctx.message.delete()
except discord.Forbidden:
pass

await ctx.channel.trigger_typing()
query = urllib.request.urlopen("http://www.gelbooru.com/index.php?page=post&s=random").read()
soup = bs.BeautifulSoup(query, 'html.parser')
sans = soup.find_all('div', {'class': 'highres-show'})
partial = soup.find(id="image").get("src")
image = partial.replace('//', '/').replace(':/', '://')

em = discord.Embed(colour=discord.Colour(0xed791d))
em.description = f'[Full Size Link*]({image})'
em.set_image(url=image)
em.set_footer(text='* click link at your own risk!')
try:
await ctx.send(embed=em)
except discord.HTTPException:
# em_list = await embedtobox.etb(em)
# for page in em_list:
# await ctx.send(page)
await ctx.send('Unable to send embeds here!')
try:
async with ctx.session.get(image) as resp:
image = await resp.read()
with io.BytesIO(image) as file:
await ctx.send(file=discord.File(file, 'gelbooru.png'))
except discord.HTTPException:
await ctx.send(image)

except Exception as e:
await ctx.send(f'```{e}```')

@nsfw.command()
async def gif(self, ctx, *, tag):
""" Get a random lewd gif
Usage: gif <tag>
Available tags: rule34, nsfw, hentai, tits... """
try:
await ctx.message.delete()
except discord.Forbidden:
pass
g = safygiphy.Giphy()
gif = g.random(tag=tag)
color = await ctx.get_dominant_color(ctx.author.avatar_url)
em = discord.Embed(color=color)
em.set_image(url=str(gif.get('data', {}).get('image_original_url')))
try:
await ctx.send(embed=em)
except discord.HTTPException:
em_list = await embedtobox.etb(em)
for page in em_list:
await ctx.send(page)


def setup(bot):
bot.add_cog(Nsfw(bot))
2 changes: 1 addition & 1 deletion cogs/gitcog.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ async def issue(self, ctx, repo, issueid):

@commands.command()
async def makeissue(self, ctx, repo, title, *, body):
'''Create an issue! `{}makeissue <title> | <body>`'''.format(ctx.prefix)
'''Create an issue! `{p}makeissue <title> | <body>`'''
async with ctx.session.post(f'https://api.github.com/repos/{repo}/issues', json={"title": title, "body": body}, headers={'Authorization': f'Bearer {self.githubtoken}'}) as resp:
if resp.status == 200 or resp.status == 201:
issueinfo = await resp.json()
Expand Down
24 changes: 24 additions & 0 deletions cogs/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
from urllib.request import urlopen
from sympy import solve
from PIL import Image
import safygiphy
from ext import embedtobox


class NumericStringParserForPython3(object):
Expand Down Expand Up @@ -152,6 +154,28 @@ def __init__(self, bot):
self.bot = bot
self.emoji_converter = commands.EmojiConverter()
self.nsp=NumericStringParserForPython3()

@commands.command()
async def gif(self, ctx, *, tag):
''' Get a random gif. Usage: gif <tag>
this command is sfw, to use nsfw gifs
load community.nsfw '''
g = safygiphy.Giphy()
tag = tag.lower()
with open('data/nsfw.json')as f:
nsfwgif = json.load(f)
if tag in nsfwgif:
return await ctx.send('`Please use the nsfw commands to see content like this.`', delete_after=5)
gif = g.random(tag=tag)
color = await ctx.get_dominant_color(ctx.author.avatar_url)
em = discord.Embed(color=color)
em.set_image(url=str(gif.get('data', {}).get('image_original_url')))
try:
await ctx.send(embed=em)
except discord.HTTPException:
em_list = await embedtobox.etb(em)
for page in em_list:
await ctx.send(page)

@commands.command()
async def embedsay(self, ctx, *, message):
Expand Down
Loading