mirror of
https://github.com/myned/modufur.git
synced 2024-12-25 06:37:29 +00:00
Merge branch 'dev'
This commit is contained in:
commit
5434ff13c7
4 changed files with 95 additions and 70 deletions
|
@ -483,6 +483,19 @@ class MsG:
|
||||||
|
|
||||||
return args
|
return args
|
||||||
|
|
||||||
|
def _get_score(self, score):
|
||||||
|
if score <= 0:
|
||||||
|
return 'https://emojipedia-us.s3.amazonaws.com/thumbs/320/mozilla/36/pile-of-poo_1f4a9.png'
|
||||||
|
elif 10 > score > 0:
|
||||||
|
return 'https://emojipedia-us.s3.amazonaws.com/thumbs/320/twitter/103/white-medium-star_2b50.png'
|
||||||
|
elif 50 > score >= 10:
|
||||||
|
return 'https://emojipedia-us.s3.amazonaws.com/thumbs/320/twitter/103/glowing-star_1f31f.png'
|
||||||
|
elif 100 > score >= 50:
|
||||||
|
return 'https://emojipedia-us.s3.amazonaws.com/thumbs/320/twitter/103/dizzy-symbol_1f4ab.png'
|
||||||
|
elif score >= 100:
|
||||||
|
return 'https://emojipedia-us.s3.amazonaws.com/thumbs/320/twitter/103/sparkles_2728.png'
|
||||||
|
return None
|
||||||
|
|
||||||
async def _get_pool(self, ctx, *, destination, booru='e621', query=[]):
|
async def _get_pool(self, ctx, *, destination, booru='e621', query=[]):
|
||||||
def on_reaction(reaction, user):
|
def on_reaction(reaction, user):
|
||||||
if reaction.emoji == '🛑' and reaction.message.id == ctx.message.id and user is ctx.author:
|
if reaction.emoji == '🛑' and reaction.message.id == ctx.message.id and user is ctx.author:
|
||||||
|
@ -556,12 +569,14 @@ class MsG:
|
||||||
if tag == 'swf' or tag == 'webm' or tag in blacklist:
|
if tag == 'swf' or tag == 'webm' or tag in blacklist:
|
||||||
raise exc.TagBlacklisted(tag)
|
raise exc.TagBlacklisted(tag)
|
||||||
|
|
||||||
|
order = [tag for tag in tags if 'order:' in tag]
|
||||||
|
if order:
|
||||||
|
order = order[0]
|
||||||
|
tags.remove(order)
|
||||||
|
else:
|
||||||
|
order = 'order:random'
|
||||||
|
|
||||||
# Checks for blacklisted tags in endpoint blacklists - try/except is for continuing the parent loop
|
# Checks for blacklisted tags in endpoint blacklists - try/except is for continuing the parent loop
|
||||||
order = False
|
|
||||||
for tag in tags:
|
|
||||||
if 'order:' in tag:
|
|
||||||
order = True
|
|
||||||
tags = ','.join(['order:random'] + tags) if not order else ','.join(tags)
|
|
||||||
posts = {}
|
posts = {}
|
||||||
temposts = len(posts)
|
temposts = len(posts)
|
||||||
empty = 0
|
empty = 0
|
||||||
|
@ -569,7 +584,7 @@ class MsG:
|
||||||
while len(posts) < limit:
|
while len(posts) < limit:
|
||||||
if c == limit * 5 + self.LIMIT:
|
if c == limit * 5 + self.LIMIT:
|
||||||
raise exc.Timeout
|
raise exc.Timeout
|
||||||
request = await u.fetch('https://{}.net/post/index.json'.format(booru), params={'tags': tags, 'limit': int(self.LIMIT * limit)}, json=True)
|
request = await u.fetch('https://{}.net/post/index.json'.format(booru), params={'tags': ','.join([order] + tags), 'limit': int(self.LIMIT * limit)}, json=True)
|
||||||
if len(request) == 0:
|
if len(request) == 0:
|
||||||
raise exc.NotFound(formatter.tostring(tags))
|
raise exc.NotFound(formatter.tostring(tags))
|
||||||
if len(request) < limit:
|
if len(request) < limit:
|
||||||
|
@ -585,7 +600,8 @@ class MsG:
|
||||||
except exc.Continue:
|
except exc.Continue:
|
||||||
continue
|
continue
|
||||||
if post['id'] not in posts.keys() and post['id'] not in previous.keys():
|
if post['id'] not in posts.keys() and post['id'] not in previous.keys():
|
||||||
posts[post['id']] = {'artist': ', '.join(post['artist']), 'url': post['file_url']}
|
posts[post['id']] = {'artist': ', '.join(
|
||||||
|
post['artist']), 'url': post['file_url'], 'score': post['score']}
|
||||||
if len(posts) == limit:
|
if len(posts) == limit:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -599,7 +615,7 @@ class MsG:
|
||||||
c += 1
|
c += 1
|
||||||
|
|
||||||
if posts:
|
if posts:
|
||||||
return posts
|
return posts, order
|
||||||
else:
|
else:
|
||||||
raise exc.NotFound
|
raise exc.NotFound
|
||||||
|
|
||||||
|
@ -640,8 +656,8 @@ class MsG:
|
||||||
embed.set_image(url=values[c - 1]['url'])
|
embed.set_image(url=values[c - 1]['url'])
|
||||||
embed.set_author(name=pool['name'],
|
embed.set_author(name=pool['name'],
|
||||||
url='https://e621.net/pool/show?id={}'.format(pool['id']), icon_url=ctx.author.avatar_url)
|
url='https://e621.net/pool/show?id={}'.format(pool['id']), icon_url=ctx.author.avatar_url)
|
||||||
embed.set_footer(text='{} / {}'.format(c, len(posts)),
|
embed.set_footer(text='{} {} / {}'.format(values[c - 1]['score'], c, len(posts)),
|
||||||
icon_url='http://lh6.ggpht.com/d3pNZNFCcJM8snBsRSdKUhR9AVBnJMcYYrR92RRDBOzCrxZMhuTeoGOQSmSEn7DAPQ=w300')
|
icon_url=self._get_score(values[c - 1]['score']))
|
||||||
|
|
||||||
paginator = await dest.send(embed=embed)
|
paginator = await dest.send(embed=embed)
|
||||||
|
|
||||||
|
@ -672,8 +688,8 @@ class MsG:
|
||||||
c -= 1
|
c -= 1
|
||||||
embed.title = values[c - 1]['artist']
|
embed.title = values[c - 1]['artist']
|
||||||
embed.url = 'https://e621.net/post/show/{}'.format(keys[c - 1])
|
embed.url = 'https://e621.net/post/show/{}'.format(keys[c - 1])
|
||||||
embed.set_footer(text='{} / {}'.format(c, len(posts)),
|
embed.set_footer(text='{} {} / {}'.format(values[c - 1]['score'], c, len(posts)),
|
||||||
icon_url='http://lh6.ggpht.com/d3pNZNFCcJM8snBsRSdKUhR9AVBnJMcYYrR92RRDBOzCrxZMhuTeoGOQSmSEn7DAPQ=w300')
|
icon_url=self._get_score(values[c - 1]['score']))
|
||||||
embed.set_image(url=values[c - 1]['url'])
|
embed.set_image(url=values[c - 1]['url'])
|
||||||
|
|
||||||
await paginator.edit(content='❤' if values[c - 1]['url'] in hearted else None, embed=embed)
|
await paginator.edit(content='❤' if values[c - 1]['url'] in hearted else None, embed=embed)
|
||||||
|
@ -688,8 +704,8 @@ class MsG:
|
||||||
await number.delete()
|
await number.delete()
|
||||||
embed.title = values[c - 1]['artist']
|
embed.title = values[c - 1]['artist']
|
||||||
embed.url = 'https://e621.net/post/show/{}'.format(keys[c - 1])
|
embed.url = 'https://e621.net/post/show/{}'.format(keys[c - 1])
|
||||||
embed.set_footer(text='{} / {}'.format(c, len(posts)),
|
embed.set_footer(text='{} {} / {}'.format(values[c - 1]['score'], c, len(posts)),
|
||||||
icon_url='http://lh6.ggpht.com/d3pNZNFCcJM8snBsRSdKUhR9AVBnJMcYYrR92RRDBOzCrxZMhuTeoGOQSmSEn7DAPQ=w300')
|
icon_url=self._get_score(values[c - 1]['score']))
|
||||||
embed.set_image(url=values[c - 1]['url'])
|
embed.set_image(url=values[c - 1]['url'])
|
||||||
|
|
||||||
await paginator.edit(content='❤' if values[c - 1]['url'] in hearted else None, embed=embed)
|
await paginator.edit(content='❤' if values[c - 1]['url'] in hearted else None, embed=embed)
|
||||||
|
@ -699,8 +715,8 @@ class MsG:
|
||||||
c += 1
|
c += 1
|
||||||
embed.title = values[c - 1]['artist']
|
embed.title = values[c - 1]['artist']
|
||||||
embed.url = 'https://e621.net/post/show/{}'.format(keys[c - 1])
|
embed.url = 'https://e621.net/post/show/{}'.format(keys[c - 1])
|
||||||
embed.set_footer(text='{} / {}'.format(c, len(posts)),
|
embed.set_footer(text='{} {} / {}'.format(values[c - 1]['score'], c, len(posts)),
|
||||||
icon_url='http://lh6.ggpht.com/d3pNZNFCcJM8snBsRSdKUhR9AVBnJMcYYrR92RRDBOzCrxZMhuTeoGOQSmSEn7DAPQ=w300')
|
icon_url=self._get_score(values[c - 1]['score']))
|
||||||
embed.set_image(url=values[c - 1]['url'])
|
embed.set_image(url=values[c - 1]['url'])
|
||||||
|
|
||||||
await paginator.edit(content='❤' if values[c - 1]['url'] in hearted else None, embed=embed)
|
await paginator.edit(content='❤' if values[c - 1]['url'] in hearted else None, embed=embed)
|
||||||
|
@ -774,17 +790,17 @@ class MsG:
|
||||||
|
|
||||||
await ctx.trigger_typing()
|
await ctx.trigger_typing()
|
||||||
|
|
||||||
posts = await self._get_posts(ctx, booru='e621', tags=tags, limit=limit)
|
posts, order = await self._get_posts(ctx, booru='e621', tags=tags, limit=limit)
|
||||||
keys = list(posts.keys())
|
keys = list(posts.keys())
|
||||||
values = list(posts.values())
|
values = list(posts.values())
|
||||||
|
|
||||||
embed = d.Embed(
|
embed = d.Embed(
|
||||||
title=values[c - 1]['artist'], url='https://e621.net/post/show/{}'.format(keys[c - 1]), color=ctx.me.color if isinstance(ctx.channel, d.TextChannel) else self.color)
|
title=values[c - 1]['artist'], url='https://e621.net/post/show/{}'.format(keys[c - 1]), color=ctx.me.color if isinstance(ctx.channel, d.TextChannel) else self.color)
|
||||||
embed.set_image(url=values[c - 1]['url'])
|
embed.set_image(url=values[c - 1]['url'])
|
||||||
embed.set_author(name=formatter.tostring(tags, random=True),
|
embed.set_author(name=formatter.tostring(tags, order=order),
|
||||||
url='https://e621.net/post?tags={}'.format(','.join(tags)), icon_url=ctx.author.avatar_url)
|
url='https://e621.net/post?tags={}'.format(','.join(tags)), icon_url=ctx.author.avatar_url)
|
||||||
embed.set_footer(text='{} / {}'.format(c, len(posts)),
|
embed.set_footer(text='{} {} / {}'.format(values[c - 1]['score'], c, len(posts)),
|
||||||
icon_url='http://lh6.ggpht.com/d3pNZNFCcJM8snBsRSdKUhR9AVBnJMcYYrR92RRDBOzCrxZMhuTeoGOQSmSEn7DAPQ=w300')
|
icon_url=self._get_score(values[c - 1]['score']))
|
||||||
|
|
||||||
paginator = await dest.send(embed=embed)
|
paginator = await dest.send(embed=embed)
|
||||||
|
|
||||||
|
@ -815,8 +831,8 @@ class MsG:
|
||||||
c -= 1
|
c -= 1
|
||||||
embed.title = values[c - 1]['artist']
|
embed.title = values[c - 1]['artist']
|
||||||
embed.url = 'https://e621.net/post/show/{}'.format(keys[c - 1])
|
embed.url = 'https://e621.net/post/show/{}'.format(keys[c - 1])
|
||||||
embed.set_footer(text='{} / {}'.format(c, len(posts)),
|
embed.set_footer(text='{} {} / {}'.format(values[c - 1]['score'], c, len(posts)),
|
||||||
icon_url='http://lh6.ggpht.com/d3pNZNFCcJM8snBsRSdKUhR9AVBnJMcYYrR92RRDBOzCrxZMhuTeoGOQSmSEn7DAPQ=w300')
|
icon_url=self._get_score(values[c - 1]['score']))
|
||||||
embed.set_image(url=values[c - 1]['url'])
|
embed.set_image(url=values[c - 1]['url'])
|
||||||
|
|
||||||
await paginator.edit(content='❤' if values[c - 1]['url'] in hearted else None, embed=embed)
|
await paginator.edit(content='❤' if values[c - 1]['url'] in hearted else None, embed=embed)
|
||||||
|
@ -831,8 +847,8 @@ class MsG:
|
||||||
await number.delete()
|
await number.delete()
|
||||||
embed.title = values[c - 1]['artist']
|
embed.title = values[c - 1]['artist']
|
||||||
embed.url = 'https://e621.net/post/show/{}'.format(keys[c - 1])
|
embed.url = 'https://e621.net/post/show/{}'.format(keys[c - 1])
|
||||||
embed.set_footer(text='{} / {}'.format(c, len(posts)),
|
embed.set_footer(text='{} {} / {}'.format(values[c - 1]['score'], c, len(posts)),
|
||||||
icon_url='http://lh6.ggpht.com/d3pNZNFCcJM8snBsRSdKUhR9AVBnJMcYYrR92RRDBOzCrxZMhuTeoGOQSmSEn7DAPQ=w300')
|
icon_url=self._get_score(values[c - 1]['score']))
|
||||||
embed.set_image(url=values[c - 1]['url'])
|
embed.set_image(url=values[c - 1]['url'])
|
||||||
|
|
||||||
await paginator.edit(content='❤' if values[c - 1]['url'] in hearted else None, embed=embed)
|
await paginator.edit(content='❤' if values[c - 1]['url'] in hearted else None, embed=embed)
|
||||||
|
@ -849,8 +865,8 @@ class MsG:
|
||||||
c += 1
|
c += 1
|
||||||
embed.title = values[c - 1]['artist']
|
embed.title = values[c - 1]['artist']
|
||||||
embed.url = 'https://e621.net/post/show/{}'.format(keys[c - 1])
|
embed.url = 'https://e621.net/post/show/{}'.format(keys[c - 1])
|
||||||
embed.set_footer(text='{} / {}'.format(c, len(posts)),
|
embed.set_footer(text='{} {} / {}'.format(values[c - 1]['score'], c, len(posts)),
|
||||||
icon_url='http://lh6.ggpht.com/d3pNZNFCcJM8snBsRSdKUhR9AVBnJMcYYrR92RRDBOzCrxZMhuTeoGOQSmSEn7DAPQ=w300')
|
icon_url=self._get_score(values[c - 1]['score']))
|
||||||
embed.set_image(url=values[c - 1]['url'])
|
embed.set_image(url=values[c - 1]['url'])
|
||||||
|
|
||||||
await paginator.edit(content='❤' if values[c - 1]['url'] in hearted else None, embed=embed)
|
await paginator.edit(content='❤' if values[c - 1]['url'] in hearted else None, embed=embed)
|
||||||
|
@ -922,15 +938,15 @@ class MsG:
|
||||||
|
|
||||||
await dest.trigger_typing()
|
await dest.trigger_typing()
|
||||||
|
|
||||||
posts = await self._get_posts(ctx, booru='e621', tags=tags, limit=limit)
|
posts, order = await self._get_posts(ctx, booru='e621', tags=tags, limit=limit)
|
||||||
|
|
||||||
for ident, post in posts.items():
|
for ident, post in posts.items():
|
||||||
embed = d.Embed(title=post['artist'], url='https://e621.net/post/show/{}'.format(ident),
|
embed = d.Embed(title=post['artist'], url='https://e621.net/post/show/{}'.format(ident),
|
||||||
color=ctx.me.color if isinstance(ctx.channel, d.TextChannel) else self.color).set_image(url=post['url'])
|
color=ctx.me.color if isinstance(ctx.channel, d.TextChannel) else self.color).set_image(url=post['url'])
|
||||||
embed.set_author(name=formatter.tostring(tags, random=True),
|
embed.set_author(name=formatter.tostring(tags, order=order),
|
||||||
url='https://e621.net/post?tags={}'.format(','.join(tags)), icon_url=ctx.author.avatar_url)
|
url='https://e621.net/post?tags={}'.format(','.join(tags)), icon_url=ctx.author.avatar_url)
|
||||||
embed.set_footer(
|
embed.set_footer(
|
||||||
text=str(ident), icon_url='http://lh6.ggpht.com/d3pNZNFCcJM8snBsRSdKUhR9AVBnJMcYYrR92RRDBOzCrxZMhuTeoGOQSmSEn7DAPQ=w300')
|
text=post['score'], icon_url=self._get_score(post['score']))
|
||||||
|
|
||||||
await dest.send(embed=embed)
|
await dest.send(embed=embed)
|
||||||
|
|
||||||
|
@ -976,15 +992,15 @@ class MsG:
|
||||||
|
|
||||||
await dest.trigger_typing()
|
await dest.trigger_typing()
|
||||||
|
|
||||||
posts = await self._get_posts(ctx, booru='e926', tags=tags, limit=limit)
|
posts, order = await self._get_posts(ctx, booru='e926', tags=tags, limit=limit)
|
||||||
|
|
||||||
for ident, post in posts.items():
|
for ident, post in posts.items():
|
||||||
embed = d.Embed(title=post['artist'], url='https://e926.net/post/show/{}'.format(ident),
|
embed = d.Embed(title=post['artist'], url='https://e926.net/post/show/{}'.format(ident),
|
||||||
color=ctx.me.color if isinstance(ctx.channel, d.TextChannel) else self.color).set_image(url=post['url'])
|
color=ctx.me.color if isinstance(ctx.channel, d.TextChannel) else self.color).set_image(url=post['url'])
|
||||||
embed.set_author(name=formatter.tostring(tags, random=True),
|
embed.set_author(name=formatter.tostring(tags, order=order),
|
||||||
url='https://e621.net/post?tags={}'.format(','.join(tags)), icon_url=ctx.author.avatar_url)
|
url='https://e621.net/post?tags={}'.format(','.join(tags)), icon_url=ctx.author.avatar_url)
|
||||||
embed.set_footer(
|
embed.set_footer(
|
||||||
text=str(ident), icon_url='http://lh6.ggpht.com/d3pNZNFCcJM8snBsRSdKUhR9AVBnJMcYYrR92RRDBOzCrxZMhuTeoGOQSmSEn7DAPQ=w300')
|
text=post['score'], icon_url=self._get_score(post['score']))
|
||||||
|
|
||||||
await dest.send(embed=embed)
|
await dest.send(embed=embed)
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,11 @@ class Bot:
|
||||||
await ctx.message.add_reaction('🌙')
|
await ctx.message.add_reaction('🌙')
|
||||||
|
|
||||||
await self.bot.get_channel(u.config['info_channel']).send('**Shutting down** 🌙 . . .')
|
await self.bot.get_channel(u.config['info_channel']).send('**Shutting down** 🌙 . . .')
|
||||||
|
|
||||||
|
u.temp['startup_chan'] = ctx.channel.id
|
||||||
|
u.temp['startup_msg'] = ctx.message.id
|
||||||
|
u.dump(u.temp, 'temp.pkl')
|
||||||
|
|
||||||
# loop = self.bot.loop.all_tasks()
|
# loop = self.bot.loop.all_tasks()
|
||||||
# for task in loop:
|
# for task in loop:
|
||||||
# task.cancel()
|
# task.cancel()
|
||||||
|
@ -47,8 +52,8 @@ class Bot:
|
||||||
await self.bot.get_channel(u.config['info_channel']).send('**Restarting** 💤 . . .')
|
await self.bot.get_channel(u.config['info_channel']).send('**Restarting** 💤 . . .')
|
||||||
# u.notify('R E S T A R T I N G')
|
# u.notify('R E S T A R T I N G')
|
||||||
|
|
||||||
u.temp['restart_ch'] = ctx.channel.id
|
u.temp['startup_chan'] = ctx.channel.id
|
||||||
u.temp['restart_msg'] = ctx.message.id
|
u.temp['startup_msg'] = ctx.message.id
|
||||||
u.dump(u.temp, 'temp.pkl')
|
u.dump(u.temp, 'temp.pkl')
|
||||||
|
|
||||||
# loop = self.bot.loop.all_tasks()
|
# loop = self.bot.loop.all_tasks()
|
||||||
|
|
|
@ -51,8 +51,8 @@ async def on_ready():
|
||||||
await bot.get_channel(u.config['info_channel']).send('**Started** ☀️ .')
|
await bot.get_channel(u.config['info_channel']).send('**Started** ☀️ .')
|
||||||
# u.notify('C O N N E C T E D')
|
# u.notify('C O N N E C T E D')
|
||||||
if u.temp:
|
if u.temp:
|
||||||
channel = bot.get_channel(u.temp['restart_ch'])
|
channel = bot.get_channel(u.temp['startup_chan'])
|
||||||
message = await channel.get_message(u.temp['restart_msg'])
|
message = await channel.get_message(u.temp['startup_msg'])
|
||||||
await message.add_reaction('✅')
|
await message.add_reaction('✅')
|
||||||
u.temp.clear()
|
u.temp.clear()
|
||||||
|
|
||||||
|
@ -70,8 +70,8 @@ async def on_error(error, *args, **kwargs):
|
||||||
await bot.get_user(u.config['owner_id']).send('**ERROR** ⚠\n```\n{}```'.format(error))
|
await bot.get_user(u.config['owner_id']).send('**ERROR** ⚠\n```\n{}```'.format(error))
|
||||||
await bot.get_channel(u.config['info_channel']).send('**ERROR** ⚠\n```\n{}```'.format(error))
|
await bot.get_channel(u.config['info_channel']).send('**ERROR** ⚠\n```\n{}```'.format(error))
|
||||||
if u.temp:
|
if u.temp:
|
||||||
channel = bot.get_channel(u.temp['restart_ch'])
|
channel = bot.get_channel(u.temp['startup_chan'])
|
||||||
message = await channel.get_message(u.temp['restart_msg'])
|
message = await channel.get_message(u.temp['startup_msg'])
|
||||||
await message.add_reaction('⚠')
|
await message.add_reaction('⚠')
|
||||||
u.temp.clear()
|
u.temp.clear()
|
||||||
# u.notify('E R R O R')
|
# u.notify('E R R O R')
|
||||||
|
@ -114,9 +114,13 @@ def after(voice, error):
|
||||||
@bot.command(name=',test', hidden=True)
|
@bot.command(name=',test', hidden=True)
|
||||||
@commands.is_owner()
|
@commands.is_owner()
|
||||||
@checks.del_ctx()
|
@checks.del_ctx()
|
||||||
async def test(ctx, message):
|
async def test(ctx):
|
||||||
if '<:N_:368917475531816962>' in message:
|
embed = d.Embed(
|
||||||
await ctx.send('<:N_:368917475531816962>')
|
title='title', url='http://lh6.ggpht.com/d3pNZNFCcJM8snBsRSdKUhR9AVBnJMcYYrR92RRDBOzCrxZMhuTeoGOQSmSEn7DAPQ=w300')
|
||||||
|
embed.add_field(name='name', value='value', inline=False)
|
||||||
|
await ctx.send(embed=embed)
|
||||||
|
# if '<:N_:368917475531816962>' in message:
|
||||||
|
# await ctx.send('<:N_:368917475531816962>')
|
||||||
# logs = []
|
# logs = []
|
||||||
# async for entry in ctx.guild.audit_logs(limit=None, action=d.AuditLogAction.message_delete):
|
# async for entry in ctx.guild.audit_logs(limit=None, action=d.AuditLogAction.message_delete):
|
||||||
# logs.append(
|
# logs.append(
|
||||||
|
|
|
@ -1,38 +1,38 @@
|
||||||
def tostring(i, *, random=False):
|
def tostring(i, *, order=None):
|
||||||
o = ''
|
o = ''
|
||||||
if i:
|
if i:
|
||||||
for v in i:
|
for v in i:
|
||||||
o += v + ' '
|
o += v + ' '
|
||||||
o = o[:-1]
|
o = o[:-1]
|
||||||
elif random is True:
|
elif order:
|
||||||
o += 'order:random'
|
o += order
|
||||||
else:
|
else:
|
||||||
o = ' '
|
o = ' '
|
||||||
return o
|
return o
|
||||||
|
|
||||||
|
|
||||||
def tostring_commas(i):
|
def tostring_commas(i):
|
||||||
if i:
|
if i:
|
||||||
o = ','
|
o = ','
|
||||||
for v in i:
|
for v in i:
|
||||||
o += v + ','
|
o += v + ','
|
||||||
return o[:-1]
|
return o[:-1]
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
||||||
def dict_tostring(i):
|
def dict_tostring(i):
|
||||||
o = ''
|
o = ''
|
||||||
if i:
|
if i:
|
||||||
for k, v in i.items():
|
for k, v in i.items():
|
||||||
o += '**' + k + ':** `' + tostring(v) + '`\n'
|
o += '**' + k + ':** `' + tostring(v) + '`\n'
|
||||||
return o
|
return o
|
||||||
|
|
||||||
|
|
||||||
def dictelem_tostring(i):
|
def dictelem_tostring(i):
|
||||||
o = ''
|
o = ''
|
||||||
if i:
|
if i:
|
||||||
for dic, elem in i.items():
|
for dic, elem in i.items():
|
||||||
o += '**__' + dic + '__**\n'
|
o += '**__' + dic + '__**\n'
|
||||||
for k, v in elem.items():
|
for k, v in elem.items():
|
||||||
o += '***' + k + ':*** `' + tostring(v) + '`\n'
|
o += '***' + k + ':*** `' + tostring(v) + '`\n'
|
||||||
return o
|
return o
|
||||||
|
|
Loading…
Reference in a new issue