Add some finishing touches
This commit is contained in:
12
cogs/bump.py
12
cogs/bump.py
@@ -23,7 +23,6 @@ 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)
|
||||||
server.update(icon_url=ctx.guild.icon_url_as(static_format="png"))
|
|
||||||
guild = ctx.guild
|
guild = ctx.guild
|
||||||
prefix = Servers(guild.id).getPrefix() if Servers(guild.id).hasPrefix else self.config["prefix"]
|
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)
|
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())
|
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()
|
servers = Servers().get_all()
|
||||||
|
|
||||||
success, fail = 0, 0
|
success, fail = 0, 0
|
||||||
@@ -91,7 +98,8 @@ class Bumps(commands.Cog):
|
|||||||
fail += 1
|
fail += 1
|
||||||
|
|
||||||
#os.remove("cache_data.json")
|
#os.remove("cache_data.json")
|
||||||
|
await wait_msg.delete()
|
||||||
|
|
||||||
done_message = await ctx.send(embed=discord.Embed(
|
done_message = await ctx.send(embed=discord.Embed(
|
||||||
title="⏫ Server Bumped",
|
title="⏫ Server Bumped",
|
||||||
description=f"Your server was bumped to `{success+fail}` servers!\n✅ There were `{success}` successful bumps!\n❎ There were `{fail}` failed ones, they got booted from the Database!",
|
description=f"Your server was bumped to `{success+fail}` servers!\n✅ There were `{success}` successful bumps!\n❎ There were `{fail}` failed ones, they got booted from the Database!",
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import discord
|
|||||||
|
|
||||||
from core.database import Servers
|
from core.database import Servers
|
||||||
from core.files import Data
|
from core.files import Data
|
||||||
|
from core.embeds import Embeds
|
||||||
|
|
||||||
commands = discord.ext.commands
|
commands = discord.ext.commands
|
||||||
|
|
||||||
@@ -34,5 +35,10 @@ class Info(commands.Cog):
|
|||||||
color=discord.Color.blurple()
|
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):
|
def setup(bot):
|
||||||
bot.add_cog(Info(bot))
|
bot.add_cog(Info(bot))
|
||||||
@@ -10,6 +10,7 @@ class BumpSetup(commands.Cog):
|
|||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
self.config = Data("config").yaml_read()
|
self.config = Data("config").yaml_read()
|
||||||
|
self.settings = Data("settings").json_read()
|
||||||
global setting_up
|
global setting_up
|
||||||
setting_up = []
|
setting_up = []
|
||||||
|
|
||||||
@@ -99,9 +100,13 @@ class BumpSetup(commands.Cog):
|
|||||||
|
|
||||||
webhook = await listing.create_webhook(name=self.config['bot_name'])
|
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.guild_only()
|
||||||
@commands.has_permissions(manage_guild=True)
|
@commands.has_permissions(manage_guild=True)
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class Servers:
|
|||||||
Update a server in the database.
|
Update a server in the database.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def update(self, **checks):
|
def update(self, **params):
|
||||||
self.col.update_one({
|
self.col.update_one({
|
||||||
"_id": self.server
|
"_id": self.server
|
||||||
}, {
|
}, {
|
||||||
|
|||||||
@@ -3,5 +3,5 @@
|
|||||||
"show_motd": false,
|
"show_motd": false,
|
||||||
"show_motd_wait": 10,
|
"show_motd_wait": 10,
|
||||||
"enable_serverlist": false,
|
"enable_serverlist": false,
|
||||||
"serverlist_url": "https://localhost:5000/"
|
"serverlist_url": "http://127.0.0.1:5000/"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user