-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Created main file. - Created various functions. - Created a api schema. - Created a json links file. - Created basic commands.
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import datetime as date | ||
import logging as log | ||
from typing import Dict | ||
|
||
import disnake as snake | ||
from disnake.ext import commands | ||
|
||
from functions.file_loader import file_loader | ||
|
||
log.getLogger(__name__) | ||
log.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', ) | ||
|
||
keywords: Dict[str, str] = await file_loader(folder="files", file="keywords", extension="toml") | ||
|
||
|
||
class About(commands.Cog): | ||
def __init__(self, bot): | ||
self.bot = bot | ||
|
||
@commands.slash_command(name="about", description="Return bot information", dm_permission=False, nsfw=False, | ||
auto_sync=True, ) | ||
async def about(self, about: snake.ApplicationCommandInteraction): | ||
try: | ||
about_embed = snake.embeds.Embed(title=keywords.get("discord_bot_name", "Winston"), | ||
description=keywords.get("discord_bot_description", | ||
"Winston is a Discord bot for Diplomacy and Strife"), | ||
color=snake.Color.green(), timestamp=date.datetime.now(), ) | ||
about_embed.add_field(name="Github", | ||
value=f"[Github Page]({keywords.get('discord_bot_github', 'https://github.com/SimonePY/Winston')})", | ||
inline=True) | ||
about_embed.add_field(name="Wiki", | ||
value=f"[Wiki Page]({keywords.get('discord_bot_wiki', 'https://github.com/SimonePY/Winston/wiki')})", | ||
inline=True) | ||
about_embed.add_field(name="Support Server", | ||
value=f"[Discord Invite]({keywords.get('discord_bot_support', 'https://discord.gg/feBVcXVYhC')})", | ||
inline=True) | ||
about_embed.set_footer(text=keywords.get("discord_bot_version", "v0.0.1")) | ||
await about.response.send_message(embed=about_embed) | ||
except Exception as e: | ||
await about.response.send_message(e) | ||
log.error(f"About Command Exception: {e}") | ||
|
||
|
||
def setup(bot): | ||
bot.add_cog(About(bot)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import logging as log | ||
from typing import Dict | ||
|
||
import disnake as snake | ||
from disnake.ext import commands | ||
|
||
from functions.file_loader import file_loader | ||
|
||
log.getLogger(__name__) | ||
log.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', ) | ||
|
||
keywords: Dict[str, str] = await file_loader(folder="files", file="keywords", extension="toml") | ||
|
||
|
||
class Invite(commands.Cog): | ||
def __init__(self, bot): | ||
self.bot = bot | ||
|
||
@commands.slash_command(name="invite", description="Return a bot invite", dm_permission=False, nsfw=False, | ||
auto_sync=True) | ||
async def invite(self, invite: snake.ApplicationCommandInteraction): | ||
try: | ||
await invite.response.send_message( | ||
f"You can invite the bot by clicking on the application and using the blue bottom.\nYou can also " | ||
f"invite the bot by using this link : [Bot Invite]({keywords.get('discord_bot_invite_link', 'https://discord.com/api/oauth2/authorize?client_id=1097527654971879464&permissions=277025508352&scope=bot%20applications.commands')})") | ||
except Exception as e: | ||
await invite.response.send_message(e) | ||
log.error(f"Invite Command Exception: {e}") | ||
|
||
|
||
def setup(bot): | ||
bot.add_cog(Invite(bot)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import datetime as date | ||
import json | ||
import logging as log | ||
from typing import Dict | ||
|
||
import disnake as snake | ||
from disnake.ext import commands | ||
|
||
from functions.file_loader import file_loader | ||
|
||
log.getLogger(__name__) | ||
log.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', ) | ||
|
||
keywords: Dict[str, str] = await file_loader(folder="files", file="keywords", extension="toml") | ||
|
||
with open('files/links.json') as f: | ||
names_urls = json.load(f) | ||
|
||
|
||
class Links(commands.Cog): | ||
def __init__(self, bot): | ||
self.bot = bot | ||
|
||
@commands.slash_command(name="links", description="Return useful game links", dm_permission=False, nsfw=False, | ||
auto_sync=True) | ||
async def links(self, links: snake.ApplicationCommandInteraction): | ||
try: | ||
links_embed = snake.Embed(title="Useful Game Links", description="Diplomacy and Strife useful links.", | ||
color=snake.Color.green(), timestamp=date.datetime.now()) | ||
for name_url in names_urls['links']: | ||
links_embed.add_field(name=name_url["name"], value=f"[Redirect]({name_url['url']})", inline=True) | ||
links_embed.set_footer(text=keywords.get("discord_bot_version", "v0.0.1")) | ||
await links.response.send_message(embed=links_embed) | ||
except Exception as e: | ||
await links.response.send_message(e) | ||
log.error(f"Links Command Exception: {e}") | ||
|
||
|
||
def setup(bot): | ||
bot.add_cog(Links(bot)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"links": [ | ||
{ | ||
"name": "Homepage", | ||
"url": "https://diplomacyandstrife.com/home" | ||
}, | ||
{ | ||
"name": "Register Page", | ||
"url": "https://diplomacyandstrife.com/register" | ||
}, | ||
{ | ||
"name": "Login Page", | ||
"url": "https://diplomacyandstrife.com/login" | ||
}, | ||
{ | ||
"name": "Rules Page", | ||
"url": "https://diplomacyandstrife.com/rules" | ||
}, | ||
{ | ||
"name": "Discord Invite", | ||
"url": "https://discord.gg/zPBms9dJhK" | ||
}, | ||
{ | ||
"name": "Wiki Page", | ||
"url": "https://diplomacy-strife.fandom.com/wiki/Diplomacy_%26_Strife_Wiki" | ||
}, | ||
{ | ||
"name": "Edit Page", | ||
"url": "https://politicsandwar.com/nation/edit/" | ||
}, | ||
{ | ||
"name": "Tools Page", | ||
"url": "https://diplomacyandstrife.com/tools" | ||
}, | ||
{ | ||
"name": "Board Page", | ||
"url": "https://diplomacyandstrife.com/allianceboard" | ||
}, | ||
{ | ||
"name": "Account Page", | ||
"url": "https://diplomacyandstrife.com/account" | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"Endpoint": [ | ||
{ | ||
"name": "Nations", | ||
"url": "http://diplomacyandstrifeapi.com/api//nation?APICode=" | ||
}, | ||
{ | ||
"name": "Nation", | ||
"url": "http://diplomacyandstrifeapi.com/api//nation?APICode=&&NationId=" | ||
}, | ||
{ | ||
"name": "Alliances", | ||
"url": "http://diplomacyandstrifeapi.com/api//alliance?APICode=" | ||
} | ||
] | ||
} |