1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-12-24 14:27:27 +00:00

2 > 4 space

This commit is contained in:
Myned 2017-10-20 16:23:27 -04:00
parent 8a0ba12f20
commit 51a002bb3f
2 changed files with 39 additions and 39 deletions

View file

@ -14,48 +14,48 @@ owner_id = u.config['owner_id']
def is_owner():
async def predicate(ctx):
return ctx.message.author.id == owner_id
return commands.check(predicate)
async def predicate(ctx):
return ctx.message.author.id == owner_id
return commands.check(predicate)
def is_admin():
def predicate(ctx):
return ctx.message.author.guild_permissions.administrator
return commands.check(predicate)
def predicate(ctx):
return ctx.message.author.guild_permissions.administrator
return commands.check(predicate)
def is_mod():
def predicate(ctx):
return ctx.message.author.guild_permissions.ban_members
return commands.check(predicate)
def predicate(ctx):
return ctx.message.author.guild_permissions.ban_members
return commands.check(predicate)
def owner(ctx):
return ctx.message.author.id == owner_id
return ctx.message.author.id == owner_id
def admin(ctx):
return ctx.message.author.guild_permissions.administrator
return ctx.message.author.guild_permissions.administrator
def mod(ctx):
return ctx.message.author.guild_permissions.ban_members
return ctx.message.author.guild_permissions.ban_members
def is_nsfw():
def predicate(ctx):
if isinstance(ctx.message.channel, d.TextChannel):
return ctx.message.channel.is_nsfw()
return True
return commands.check(predicate)
def predicate(ctx):
if isinstance(ctx.message.channel, d.TextChannel):
return ctx.message.channel.is_nsfw()
return True
return commands.check(predicate)
def del_ctx():
async def predicate(ctx):
with suppress(AttributeError):
if ctx.guild.id in u.settings['del_ctx'] and ctx.me.permissions_in(ctx.channel).manage_messages and isinstance(ctx.message.channel, d.TextChannel):
with suppress(err.NotFound):
await ctx.message.delete()
return True
return commands.check(predicate)
async def predicate(ctx):
with suppress(AttributeError):
if ctx.guild.id in u.settings['del_ctx'] and ctx.me.permissions_in(ctx.channel).manage_messages and isinstance(ctx.message.channel, d.TextChannel):
with suppress(err.NotFound):
await ctx.message.delete()
return True
return commands.check(predicate)

View file

@ -8,26 +8,26 @@ from utils import utils as u
async def get_post(url):
content = await u.fetch('http://iqdb.harry.lu', params={'url': url})
content = await u.fetch('http://iqdb.harry.lu', params={'url': url})
try:
value = BeautifulSoup(content, 'html.parser').find_all('a')[1].get('href')
if value != '#':
return value
else:
raise IndexError
except IndexError:
try:
raise exc.MatchError(re.search('\/([^\/]+)$', url).group(1))
value = BeautifulSoup(content, 'html.parser').find_all('a')[1].get('href')
if value != '#':
return value
else:
raise IndexError
except IndexError:
try:
raise exc.MatchError(re.search('\/([^\/]+)$', url).group(1))
except AttributeError:
raise exc.MissingArgument
except AttributeError:
raise exc.MissingArgument
async def get_image(url):
content = await u.fetch(url)
content = await u.fetch(url)
value = html.fromstring(content).xpath(
'string(/html/body/div[@id="content"]/div[@id="post-view"]/div[@class="content"]/div[2]/img/@src)')
value = html.fromstring(content).xpath(
'string(/html/body/div[@id="content"]/div[@id="post-view"]/div[@class="content"]/div[2]/img/@src)')
return value
return value