Skip to content

Commit 902df98

Browse files
committed
Add sponsors command
1 parent f6ca5db commit 902df98

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

cogs/utility.py

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from io import StringIO
1010
from typing import Union
1111
from types import SimpleNamespace as param
12-
from json import JSONDecodeError
12+
from json import JSONDecodeError, loads
1313
from textwrap import indent
1414

1515
from discord import Embed, Color, Activity, Role
@@ -237,7 +237,6 @@ async def about(self, ctx):
237237

238238
embed.add_field(name="Uptime", value=self.bot.uptime)
239239
embed.add_field(name="Latency", value=f"{self.bot.latency * 1000:.2f} ms")
240-
241240
embed.add_field(name="Version", value=f"`{self.bot.version}`")
242241
embed.add_field(name="Author", value="[`kyb3r`](https://github.com/kyb3r)")
243242

@@ -253,14 +252,32 @@ async def about(self, ctx):
253252
name="GitHub", value="https://github.com/kyb3r/modmail", inline=False
254253
)
255254

256-
embed.add_field(
257-
name="\u200b",
258-
value="Support this bot on [Patreon](https://patreon.com/kyber).",
259-
)
255+
embed.add_field(name="Donate", value="[Patreon](https://patreon.com/kyber)")
256+
257+
embed.add_field(name="Sponsers", value=f"`{self.bot.prefix}sponsors`")
260258

261259
embed.set_footer(text=footer)
262260
await ctx.send(embed=embed)
263261

262+
@commands.command()
263+
@checks.has_permissions(PermissionLevel.REGULAR)
264+
@trigger_typing
265+
async def sponsors(self, ctx):
266+
"""Shows a list of sponsors."""
267+
resp = await self.bot.session.get(
268+
"https://raw.githubusercontent.com/kyb3r/modmail/master/SPONSORS.json"
269+
)
270+
data = loads(await resp.text())
271+
272+
embeds = []
273+
274+
for elem in data:
275+
em = Embed.from_dict(elem["embed"])
276+
embeds.append(em)
277+
278+
session = PaginatorSession(ctx, *embeds)
279+
await session.run()
280+
264281
@commands.group(invoke_without_command=True)
265282
@checks.has_permissions(PermissionLevel.OWNER)
266283
@trigger_typing

0 commit comments

Comments
 (0)