mirror of
https://github.com/myned/modufur.git
synced 2024-12-24 14:27:27 +00:00
Add newline switch for different formatting logic
This commit is contained in:
parent
f02bcd46fc
commit
74d1b6cb9b
2 changed files with 7 additions and 3 deletions
|
@ -95,7 +95,7 @@ class Bot:
|
||||||
if v:
|
if v:
|
||||||
permissions[member.mention].append(k)
|
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.command(name=',tasks', aliases=[',task'])
|
||||||
@cmds.is_owner()
|
@cmds.is_owner()
|
||||||
|
|
|
@ -20,17 +20,21 @@ def tostring_commas(i):
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
||||||
def dict_tostring(i, f=True):
|
def dict_tostring(i, f=True, newline=False):
|
||||||
o = ''
|
o = ''
|
||||||
|
|
||||||
if f:
|
if f:
|
||||||
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'
|
||||||
|
elif newline is True:
|
||||||
|
if i:
|
||||||
|
for k, v in i.items():
|
||||||
|
o += k + ': ```' + tostring(v, newline=newline) + '```\n'
|
||||||
else:
|
else:
|
||||||
if i:
|
if i:
|
||||||
for k, v in i.items():
|
for k, v in i.items():
|
||||||
o += k + ': ```' + tostring(v, newline=True) + '```\n'
|
o += k + ': ```' + tostring(v) + '```\n'
|
||||||
return o
|
return o
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue