Fixed error in bump

This commit is contained in:
Nemika
2021-03-08 12:26:24 +02:00
parent 4712fdb127
commit b34c24dfc4
2 changed files with 9 additions and 7 deletions

View File

@@ -22,6 +22,7 @@ class Bumps(commands.Cog):
@commands.command() @commands.command()
async def bump(self, ctx): async def bump(self, ctx):
server = Servers(ctx.guild.id) server = Servers(ctx.guild.id)
guild = ctx.guild
if not server.get(): if not server.get():
ctx.command.reset_cooldown(ctx) ctx.command.reset_cooldown(ctx)
@@ -40,18 +41,18 @@ class Bumps(commands.Cog):
invite = await invite_channel.create_invite(max_uses=0, max_age=0, unique=False) invite = await invite_channel.create_invite(max_uses=0, max_age=0, unique=False)
embed = discord.Embed( embed = discord.Embed(
title=server.name, title=guild.name,
description=entry['description'], description=entry['description'],
color=discord.Color(value=entry['color']), color=discord.Color(value=entry['color']),
url=invite.url url=invite.url
) )
embed.add_field(name="🌍 Members", value=len(server.members)) embed.add_field(name="🌍 Members", value=len(guild.members))
embed.add_field(name="🤣 Emojis", value=f"{len(server.emojis)}/{server.emoji_limit}") embed.add_field(name="🤣 Emojis", value=f"{len(guild.emojis)}/{guild.emoji_limit}")
embed.add_field(name="💎 Boost Tier", value=f"Tier {server.premium_tier} ({server.premium_subscription_count} Boosts)") embed.add_field(name="💎 Boost Tier", value=f"Tier {guild.premium_tier} ({guild.premium_subscription_count} Boosts)")
embed.add_field(name="👑 Owner", value=str(server.owner)) embed.add_field(name="👑 Owner", value=str(guild.owner))
embed.add_field(name="🔗 Invite", value=f"[Click to join!]({invite.url})") embed.add_field(name="🔗 Invite", value=f"[Click to join!]({invite.url})")
embed.set_thumbnail(url=server.icon_url_as(static_format="png")) embed.set_thumbnail(url=guild.icon_url_as(static_format="png"))
embed.set_footer(text=f"Powered by • {self.config['bot_name']}") embed.set_footer(text=f"Powered by • {self.config['bot_name']}")
@@ -63,7 +64,7 @@ class Bumps(commands.Cog):
success += 1 success += 1
except Exception as e: except Exception as e:
error = f"{e.__class__.__name__}" error = f"{e}"
value = io.StringIO().getvalue() value = io.StringIO().getvalue()
print(f"{Fore.RED}[ERROR] {Style.RESET_ALL}{error}\n{Fore.YELLOW}Error was recorded in {Fore.RED}error.log") print(f"{Fore.RED}[ERROR] {Style.RESET_ALL}{error}\n{Fore.YELLOW}Error was recorded in {Fore.RED}error.log")
#with open("error.log", "w+") as f: #with open("error.log", "w+") as f:

View File

@@ -1,6 +1,7 @@
import discord import discord
from humanfriendly import format_timespan as ftime from humanfriendly import format_timespan as ftime
from humanfriendly import round_number
from core import embeds from core import embeds
commands = discord.ext.commands commands = discord.ext.commands