def post(): args = request.args table = tools.Table(db, 'blog') if not args: redirect(URL(c='blog', f='index')) else: post = table.get_article(args[0]) return {'post': post}
def article(): args = request.args table = tools.Table(db, 'wall') if not args: redirect(URL(c='wall', f='index')) else: article = table.get_article(args[0]) return {'article': article}
def index(): args = request.args table = tools.Table(db, 'blog') limit = 10 blog = table.get_contents([0, limit]) numeration = tools.Pagination().get_numeration(blog['count'], limit) if args: index = int(args[0]) start = limit * index - limit end = limit * index blog = table.get_contents([start, end]) return { 'blog': blog, 'limit': limit, 'numeration': numeration, 'args': args }
('Favorite Weapon', get_favorite_weapon)] if len(user_data) == 1: user = user_data[0] embed = discord.Embed(title=(await get_usernames(user)), description='Recent Stats', color=random.choice(splatoon.COLORS)) for field, func in rows[1:]: embed.add_field(name=field, value=(await func(user)), inline=True) await ctx.channel.send(embed=embed) return result = tools.Table(just='right') for title, func in rows: result.append([title, *[(await func(x)) for x in user_data]]) await ctx.channel.send(f'```{str(result)}```') @commands.command(aliases=['ranking', 'ranks']) async def rank(self, ctx, *args): '''Get ranks for users. args is multiple arguments separated by spaces. Each argument must be a: Discord user mention (@user): If the mentioned user has linked their Nintendo account to Discord If multiple users are given, the response is formatted in a table with all of their ranks side-by-side. If one user is given, the response is a prettier embed with their rankings. ''' mention_pattern = r'<@!?(\d+)>' mention_matches = [
def index(): articles = t.Table(db, 'wall').get_contents() posts = t.Table(db, 'blog').get_contents() return {'articles': articles, 'posts': posts}