-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
118 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
from discord.ext import commands, bridge | ||
from discord import Embed | ||
from utils import Utils | ||
|
||
|
||
class Privacy(commands.Cog): | ||
def __init__(self, bot): | ||
self.bot = bot | ||
|
||
@bridge.bridge_command(description = "Shows the privacy policy of the bot.") | ||
@bridge.bridge_command(description="Shows the privacy policy of the bot.") | ||
async def privacy(self, ctx): | ||
embed = Embed() | ||
embed.description = f"{self.bot.user.name} saves a minimal amount of data to allow for its functionality. As we work on regaining full functionality, we do not currently collect anything On our database storage, we currently only have server IPs and guild IDs stored. For any concerns, Mail to [email protected] or join https://discord.gg/Ukr89GrMBk" | ||
embed.colour = Utils.Colors.blue | ||
await ctx.respond(embed=embed) | ||
|
||
|
||
def setup(bot): | ||
bot.add_cog(Privacy(bot)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,31 @@ | ||
from discord.ext import commands#, bridge | ||
from discord.ext import commands, bridge | ||
from utils import Utils | ||
|
||
|
||
class SetServer(commands.Cog): | ||
def __init__(self, bot): | ||
self.bot = bot | ||
|
||
#@bridge.bridge_command(aliases=["set"], description="Set the default server to use if no argument is provided in the status command.") | ||
#async def setserver(self, ctx, server = None): | ||
# if server is None: | ||
# return await ctx.respond("Please provide a server IP.") | ||
# await ctx.defer() | ||
#This is up to Miataboy to implement | ||
@bridge.bridge_command(aliases=["set"], | ||
description="Set the default server to use if no argument is provided in the status command.") | ||
async def setserver(self, ctx, server=None): | ||
if server is None: | ||
return await ctx.respond( | ||
"Please provide a server IP to register to this guild. If an IP is already registered, it'll be overwritten") | ||
if not server.endswith(".aternos.me"): | ||
server += ".aternos.me" | ||
if server.count(".") > 2: | ||
return await ctx.respond("Please provide a valid Aternos server ip!\nExample: example.aternos.me") | ||
cursor = await Utils.mysql_login() | ||
database = cursor.cursor() | ||
database.execute( | ||
"INSERT INTO server (guild_id, server_ip) VALUES (%s, %s) ON DUPLICATE KEY UPDATE server_ip = %s", | ||
(ctx.guild_id, server, server)) | ||
cursor.commit() | ||
database.close() | ||
cursor.close() | ||
return await ctx.respond(f'The IP has been set to {server}. Use `status` without an argument to view it.') | ||
|
||
|
||
def setup(bot): | ||
bot.add_cog(SetServer(bot)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,36 @@ | ||
from discord import Intents, Status, Activity, ActivityType | ||
from discord.ext.bridge import Bot | ||
from utils import Utils | ||
|
||
data = Utils.get_data() | ||
intents = Intents(guilds=True, guild_messages=True) | ||
#intents.message_content = True #Uncomment this if you use prefixed command that are not mentions | ||
bot = Bot(intents=intents, command_prefix=data['Prefix'], status=Status.dnd, activity=Activity(type=ActivityType.watching, name="you (prefix: @mention)")) | ||
bot.load_extensions("cogs") #Loads all cogs in the cogs folder | ||
bot.help_command = Utils.HelpCmd() #Disables the default help command | ||
# intents.message_content = True #Uncomment this if you use prefixed command that are not mentions | ||
bot = Bot(intents=intents, command_prefix=data['Prefix'], status=Status.dnd, | ||
activity=Activity(type=ActivityType.watching, name="you (prefix: @mention)")) | ||
bot.load_extensions("cogs") # Loads all cogs in the cogs folder | ||
bot.help_command = Utils.HelpCmd() # Disables the default help command | ||
BOOTED = False | ||
|
||
|
||
@bot.listen() | ||
async def on_connect(): | ||
print('Connected to Discord!') | ||
cursor = await Utils.mysql_login() | ||
database = cursor.cursor() | ||
database.execute("CREATE TABLE IF NOT EXISTS server (guild_id VARCHAR(255) PRIMARY KEY, server_ip TEXT NOT NULL)") | ||
database.close() | ||
|
||
|
||
@bot.listen() | ||
async def on_ready(): | ||
global BOOTED | ||
if BOOTED: | ||
print ("Reconnect(?)") | ||
print("Reconnect(?)") | ||
if not BOOTED: | ||
#await bot.sync_commands() #You might need to uncomment this if the slash commands aren't appearing | ||
# await bot.sync_commands() #You might need to uncomment this if the slash commands aren't appearing | ||
print(f'Logged in as {bot.user}') | ||
print('------') | ||
BOOTED = True | ||
|
||
|
||
bot.run(data['Token']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
py-cord==2.4.0 | ||
python-dotenv==0.21.0 | ||
mcstatus==10.0.1 | ||
asyncmy==0.2.5 | ||
asyncmy==0.2.5 | ||
mysql-connector-python==8.0.32 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters