Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename project #19

Merged
merged 2 commits into from
Apr 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Setting up Foxcord
# Setting up neo

## Standard
1. [First install minimum Python 3.10](https://www.python.org/downloads/)
Expand All @@ -12,7 +12,7 @@ Use `.` instead of `.[dev]` for production.
1. [This guide is under the presumption you have Docker installed.](https://docs.docker.com/get-docker/)
2. Setup `.env` file inside `settings/` folder with key value `TOKEN=XXX`
3. It is heavily suggested to use `compose v2` which can be [installed from official Docker documentation](https://docs.docker.com/compose/cli-command/)
4. Run the following command: `docker build -t "foxcord:latest" .` to build the image `foxcord:latest`
4. Run the following command: `docker build -t "neo:latest" .` to build the image `neo:latest`
5. Using `v2 compose` to run the bot: `docker compose up` in the same location as `docker-compose.yml`

# Contributing
Expand Down
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
<p align="center">
<img src="https://i.imgur.com/DGLrWwX.png/" height="500" width="500" >
</p>

# Description
- Foxcord Version: 0.0.5
- neo Version: 0.0.5

Foxcord aims to be beginner-friendly, but will also fall in the category for experienced users.
neo aims to be beginner-friendly, but will also fall in the category for experienced users.

The objective of this bot is to keep the code as dynamic and modular as possible whilst minimising reliability between
"modules".
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version: '3.2'
services:
foxcord:
image: foxcord:latest
neo:
image: neo:latest
command: "python /usr/src/app/main.py"
6 changes: 3 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import sys
import disnake
from foxcord.bot.foxcord import Foxcord
from neo.bot.neo import Neo

if __name__ == "__main__":
if sys.version_info[0:2] != (3, 10):
print(f"Python version must be minimum 3.10. Currently detected version: "
f"{str(sys.version_info.major) + '.' + str(sys.version_info.minor)}")
exit(1)
foxcord = Foxcord(test_guilds=[956780366063095808], intents=disnake.Intents.default())
foxcord.run(foxcord.data.token)
neo = Neo(test_guilds=[956780366063095808], intents=disnake.Intents.default())
neo.run(neo.data.token)
4 changes: 2 additions & 2 deletions settings/foxcord.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
foxcord:
neo:
version: 0.0.4
databaseEnabled: False
mode: development
Expand All @@ -14,7 +14,7 @@ logData:
testLog: logs/test.log

commandData:
cogPath: src.foxcord.commands.cogs
cogPath: src.neo.commands.cogs
userCog: user
modCog: mod
adminCog: admin
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[metadata]
name = Foxcord
name = neo
version = 0.0.4
description = Bot template.
long_description = file: README.md
Expand Down
File renamed without changes.
File renamed without changes.
15 changes: 7 additions & 8 deletions src/foxcord/bot/foxcord.py → src/neo/bot/neo.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

from typing import Any
import disnake
from foxcord.logging.log import Log
from foxcord.config.data import Data
from foxcord.database.sql import Sql
from foxcord.commands.controller import CommandController
from neo.logging.log import Log
from neo.config.data import Data
from neo.database.sql import Sql
from neo.commands.controller import CommandController
from test.test_actions import TestActions
from disnake.ext import commands
from foxcord.bot.utility import collapse_embeds


class Foxcord(commands.Bot):
class Neo(commands.Bot):
test = TestActions()
test.assertTokenValidity()
test.assertValidConfig()
Expand All @@ -20,7 +19,7 @@ class Foxcord(commands.Bot):

def __init__(self, *args: Any, **kwargs: Any):
super().__init__(*args, **kwargs)
self.log.info("Foxcord is starting -> loading command controller")
self.log.info("Neo is starting -> loading command controller")
self.command_controller = CommandController(self).load()
if self.data.databaseEnabled:
self.log.info("Database is enabled, starting")
Expand All @@ -31,7 +30,7 @@ def __init__(self, *args: Any, **kwargs: Any):
self.log.warn("SQL IS DISABLED")

async def on_ready(self):
self.log.info("Foxcord is now connected, enjoy your stay.")
self.log.info("neo is now connected, enjoy your stay.")

async def on_message(self, interaction: disnake.InteractionMessage):
if interaction.author == self.user:
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from foxcord.config.data import Data
from foxcord.logging.log import Log
from neo.config.data import Data
from neo.logging.log import Log
from disnake.ext import commands
import disnake as discord

Expand All @@ -9,7 +9,7 @@ class Ban(commands.Cog):

def __init__(self, bot):
self.bot = bot
self.foxcord_log = Log().create(__name__, self.data.botLog)
self.neo_log = Log().create(__name__, self.data.botLog)

@commands.Cog.listener()
async def on_ready(self):
Expand All @@ -27,7 +27,7 @@ async def ban(self, ctx, user: discord.User):
await ctx.send(f"You can't ban yourself, {ctx.message.author.mention}")
return
await ctx.guild.ban(user)
self.foxcord_log.warning(f"{user} has been banned!")
self.neo_log.warning(f"{user} has been banned!")
await ctx.send(f"{ctx.message.author.mention} gave the banhammer to {user}")


Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from foxcord.logging.log import Log
from foxcord.config.data import Data
from neo.logging.log import Log
from neo.config.data import Data
from disnake.ext import commands


class Unban(commands.Cog):

data = Data()
foxcord_log = Log().create(__name__, data.botLog)
neo_log = Log().create(__name__, data.botLog)


def __init__(self, bot):
Expand All @@ -26,7 +26,7 @@ async def on_ready(self):
async def unban(self, ctx, userid):
user = await self.bot.fetch_user(userid)
await ctx.guild.unban(user)
self.foxcord_log.warning(f"{user} has been unbanned!")
self.neo_log.warning(f"{user} has been unbanned!")
await ctx.send(f"{user} is now unbanned.")


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import disnake
import os
from disnake.ext import commands
from foxcord.config.data import Data
from neo.config.data import Data


class SysInfo(commands.Cog):
Expand All @@ -18,7 +18,7 @@ async def on_ready(self):
pass

@commands.slash_command(
description="Get the server information Foxcord is hosted on. Support only for Linux at the moment.",
description="Get the server information neo is hosted on. Support only for Linux at the moment.",
aliases=['si']
)
@commands.has_any_role(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from foxcord.config.data import Data
from neo.config.data import Data
from disnake.ext import commands
import disnake as discord

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import requests
import disnake
from disnake.ext import commands
from foxcord.config.data import Data
from neo.config.data import Data
class DadJoke(commands.Cog):

data = Data()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from disnake.ext import commands
from foxcord.config.data import Data
from neo.config.data import Data
import disnake


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from foxcord.config.data import Data
from foxcord.logging.log import Log
from neo.config.data import Data
from neo.logging.log import Log
import os


Expand Down
File renamed without changes.
5 changes: 2 additions & 3 deletions src/foxcord/config/data.py → src/neo/config/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Data:

env_keys = ['TOKEN', 'SQL_HOST', 'SQL_PORT',
'SQL_USER', 'SQL_PASS', 'SQL_DB']
yaml_file = 'settings/foxcord.yaml'
yaml_file = 'settings/neo.yaml'

def __init__(self):
self.read()
Expand All @@ -18,5 +18,4 @@ def read(self):
setattr(self, key, value)
env = dotenv.dotenv_values(self.envFile)
for v in self.env_keys:
setattr(self, v.lower(), env.get(v.upper()))

setattr(self, v.lower(), env.get(v.upper()))
File renamed without changes.
4 changes: 2 additions & 2 deletions src/foxcord/database/sql.py → src/neo/database/sql.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import asyncpg, asyncio
from foxcord.config.data import Data
from foxcord.logging.log import Log
from neo.config.data import Data
from neo.logging.log import Log


class Sql:
Expand Down
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions test/test_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import dotenv
import yaml
from schema import Schema, SchemaError
from foxcord.logging.log import Log
from foxcord.config.data import Data
from neo.logging.log import Log
from neo.config.data import Data


class TestActions(unittest.TestCase):
Expand Down Expand Up @@ -32,8 +32,8 @@ def assertTokenValidity(self):
self.fail()

def assertValidConfig(self):
foxcord_schema = Schema({
"foxcord": {
neo_schema = Schema({
"neo": {
"version": str,
"databaseEnabled": bool,
"mode": str,
Expand Down Expand Up @@ -69,10 +69,10 @@ def assertValidConfig(self):
"devRoleId": int,
}
})
with open("settings/foxcord.yaml", 'r') as stream:
with open("settings/neo.yaml", 'r') as stream:
y = yaml.safe_load(stream)
try:
foxcord_schema.validate(y)
neo_schema.validate(y)
except SchemaError as err:
self.log.error(err)
self.fail()