1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-11-01 13:02:38 +00:00

Add newline switch for different formatting logic

This commit is contained in:
Dylan Dizon 2018-11-06 16:28:19 -05:00
parent f02bcd46fc
commit 74d1b6cb9b
2 changed files with 7 additions and 3 deletions

View file

@ -95,7 +95,7 @@ class Bot:
if v:
permissions[member.mention].append(k)
await ctx.send(f'**Permissions:**\n\n{formatter.dict_tostring(permissions, f=False)}')
await ctx.send(f'**Permissions:**\n\n{formatter.dict_tostring(permissions, f=False, newline=True)}')
@cmds.command(name=',tasks', aliases=[',task'])
@cmds.is_owner()

View file

@ -20,17 +20,21 @@ def tostring_commas(i):
return ''
def dict_tostring(i, f=True):
def dict_tostring(i, f=True, newline=False):
o = ''
if f:
if i:
for k, v in i.items():
o += '**' + k + ':** `' + tostring(v) + '`\n'
elif newline is True:
if i:
for k, v in i.items():
o += k + ': ```' + tostring(v, newline=newline) + '```\n'
else:
if i:
for k, v in i.items():
o += k + ': ```' + tostring(v, newline=True) + '```\n'
o += k + ': ```' + tostring(v) + '```\n'
return o