Add some finishing touches

This commit is contained in:
Nemika
2021-03-08 21:46:38 +02:00
parent 07db6fdabf
commit b6561a74da
5 changed files with 25 additions and 6 deletions

View File

@@ -23,7 +23,6 @@ class Bumps(commands.Cog):
@commands.command()
async def bump(self, ctx):
server = Servers(ctx.guild.id)
server.update(icon_url=ctx.guild.icon_url_as(static_format="png"))
guild = ctx.guild
prefix = Servers(guild.id).getPrefix() if Servers(guild.id).hasPrefix else self.config["prefix"]
@@ -31,6 +30,14 @@ class Bumps(commands.Cog):
ctx.command.reset_cooldown(ctx)
return await ctx.send(embed=Embeds(f"You must setup this server first! Use `{prefix}setup` to do so!").error())
wait_msg = await ctx.send(embed=discord.Embed(
title="⏳ Bumping...",
description="Please wait while we're sending out the bumps!",
color=discord.Color.orange()
))
server.update(icon_url=str(ctx.guild.icon_url_as(static_format="png")), server_name=ctx.guild.name)
servers = Servers().get_all()
success, fail = 0, 0
@@ -91,6 +98,7 @@ class Bumps(commands.Cog):
fail += 1
#os.remove("cache_data.json")
await wait_msg.delete()
done_message = await ctx.send(embed=discord.Embed(
title="⏫ Server Bumped",

View File

@@ -2,6 +2,7 @@ import discord
from core.database import Servers
from core.files import Data
from core.embeds import Embeds
commands = discord.ext.commands
@@ -34,5 +35,10 @@ class Info(commands.Cog):
color=discord.Color.blurple()
))
@commands.guild_only()
@commands.command(aliases=["add"])
async def invite(self, ctx):
return await ctx.send(embed=Embeds(f"[Click here to invite me!](https://discord.com/api/oauth2/authorize?client_id={self.bot.user.id}&permissions=537152577&scope=bot)"))
def setup(bot):
bot.add_cog(Info(bot))

View File

@@ -10,6 +10,7 @@ class BumpSetup(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.config = Data("config").yaml_read()
self.settings = Data("settings").json_read()
global setting_up
setting_up = []
@@ -99,9 +100,13 @@ class BumpSetup(commands.Cog):
webhook = await listing.create_webhook(name=self.config['bot_name'])
Servers(ctx.guild.id).add(webhook=webhook.id, invite=invite.id, color=color, description=description, icon_url=ctx.guild.icon_url_as(static_format="png"))
Servers(ctx.guild.id).add(webhook=webhook.id, invite=invite.id, color=color, description=description, icon_url=str(ctx.guild.icon_url_as(static_format="png")), server_name=ctx.guild.name)
await ctx.send("Setup complete! Server added to DB and the webhook was created.")
return await ctx.send(embed=discord.Embed(
title="👌 Setup Complete",
description="The server was added to the Database and can now be bumped! Good luck on your server's growth! You can always use `=delete` to remove it." + (f"\nYour server was also added to our Server List! [Check it out!]({self.settings['serverlist_url']+'server/' + str(ctx.guild.id)}/)" if self.settings['enable_serverlist'] else ""),
color=discord.Color.green()
))
@commands.guild_only()
@commands.has_permissions(manage_guild=True)

View File

@@ -28,7 +28,7 @@ class Servers:
Update a server in the database.
"""
def update(self, **checks):
def update(self, **params):
self.col.update_one({
"_id": self.server
}, {

View File

@@ -3,5 +3,5 @@
"show_motd": false,
"show_motd_wait": 10,
"enable_serverlist": false,
"serverlist_url": "https://localhost:5000/"
"serverlist_url": "http://127.0.0.1:5000/"
}