Add files

This commit is contained in:
Daniel 2022-05-20 00:23:58 -07:00
parent c2d9184839
commit c757bc8fb0
No known key found for this signature in database
GPG Key ID: 771601B78F6934C8
6 changed files with 93 additions and 0 deletions

2
.env.example Normal file
View File

@ -0,0 +1,2 @@
TOKEN=""
DEVELOPER_GUILD_ID=0000

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
.DS_STORE
.env
__pycache__/

16
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,16 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": true
}
]
}

63
bot.py Normal file
View File

@ -0,0 +1,63 @@
import os
import disnake
import json
from typing import List
from disnake.ext import commands
from dotenv import load_dotenv
load_dotenv()
bot = commands.InteractionBot(
test_guilds=[int(os.getenv("DEVELOPER_GUILD_ID"))]
)
faqFile = open("faq.json")
FAQs = json.load(faqFile)
@bot.event
async def on_ready():
print("{}#{} is ready".format(bot.user.name, bot.user.discriminator))
async def autocomplete_faqs(inter, string: str) -> List[str]:
return [question for question in FAQs if string.lower() in question.lower()][:20]
# Link to Github to contribute
@bot.slash_command(auto_sync=False, description="Learn how you can contribute to the responses of this bot")
async def contribute(inter: disnake.CommandInteraction):
return await inter.response.send_message(content="You can contribute by going", ephemeral=True)
# View FAQ in an ephemeral message (For normal users)
@bot.slash_command(auto_sync=False, description="View answers to Frequently Asked Questions")
async def faq(
inter: disnake.CommandInteraction,
question: str = commands.Param(
autocomplete=autocomplete_faqs, description="The question to get an answer to")
):
if question in FAQs.keys():
faqAnswer = FAQs[question]
await inter.response.send_message(embed=disnake.Embed(title=question, description=faqAnswer), ephemeral=True)
else:
return await inter.response.send_message("Unable to find that FAQ", ephemeral=True)
# View FAQ in a public message (For mods users, Manage Messages required)
@bot.slash_command(auto_sync=False, description="View answers to Frequently Asked Questions and post it in chat", default_member_permissions=8192)
async def post_faq(
inter: disnake.CommandInteraction,
question: str = commands.Param(
autocomplete=autocomplete_faqs, description="The question to get an answer to")
):
if question in FAQs.keys():
faqAnswer = FAQs[question]
await inter.response.send_message(embed=disnake.Embed(title=question, description=faqAnswer))
else:
return await inter.response.send_message("Unable to find that FAQ", ephemeral=True)
bot.run(os.getenv("TOKEN"))

7
faq.json Normal file
View File

@ -0,0 +1,7 @@
{
"How do I install pirated games?": "Read rule 3 in <#703302242123645010>",
"What software do I need to inject a payload?": "**Windows:** [TegraRcmGUI](https://github.com/eliboa/TegraRcmGUI/releases/latest)\n**macOS / Web (Chromium-based browsers):** [Nintendo Switch Payload Loader](https://webcfw.sdsetup.com/)\n\n[More options](https://wiki.gbatemp.net/wiki/List_of_Switch_payloads)",
"How do I install Android on the Switch?": "https://forum.xda-developers.com/t/rom-unofficial-8-1-switchroot-lineageos-15-1.3951389/",
"How much space do I need for an emuMMC": "An emuMMC takes about 30GB of storage, so a 64GB would be the minimum. For the best experience, you should use a 128GB or higher SD card.",
"What DNS do I use?": "90DNS blocks all connections to Nintendo, while AquaticDNS allows some connections to Nintendo (such as Online) without telemetry.\n\n**Please note:** AquaticDNS is not ran by Team Neptune, so we can't guarantee it'll work as advertised."
}

2
requirements.txt Normal file
View File

@ -0,0 +1,2 @@
disnake==2.5.1
python-dotenv==0.20.0