Git Product home page Git Product logo

kurisu's Introduction

Kurisu

A Discord server bot developed for Nintendo Homebrew on Discord. Maintained primarily by NH staff and helpers.

Although it is open source, this bot is not really designed to be used in other setups at the moment; the source is mainly just available for those interested in how it works on the Nintendo Homebrew server.

Server template

A server template is available for testing Kurisu, with all the channels and roles necessary.

Setting up for local testing in Docker (recommended)

To test changes to Kurisu locally using Docker, make sure Docker Desktop (Windows and macOS) or Docker Engine (Linux) is installed. If you are using Windows, it's heavily recommended to use Powershell so the commands shown here run as intended.

For Linux, docker-compose must be installed separately.

Create a new application on Discord and add a bot. Put the token in token.txt in the same directory. (Newline at the end of the file doesn't matter.)

The file server_logs_url.txt is the url to a database of a different project, which is used along Kurisu in production. For local testing purposes, this file still needs to be created but can be blank, in which case the server_logs cog won't be loaded.

Set up the database volume with the following commands, this can also be used in cases in which the schema was updated and the database volume still contains an old version, missing tables necessary to run the bot. This will pull postgres:13 to run as the database, create the tables (removing them if they already exist) then stop and remove the container.

docker-compose up --build -d db
cat ./schema.sql | docker compose exec -T db psql -U kurisu -d kurisu
docker-compose down db

Start Kurisu with the following command. Assuming a clean setup, this will pull postgres:13 to run as the database, and python:3.11-alpine as the base image for Kurisu, then build a new Kurisu image. Then it will start up postgres first, then kurisu once the database is active.

docker-compose up --build

postgres database files are stored in a Docker volume called kurisutestdb. Use Ctrl-C if not running in detached mode to stop the bot.

Other useful commands

  • docker-compose build - Build only, pull base images if required

  • docker-compose build --pull - Build only, always try to pull base images for newer versions

  • docker-compose pull - Pull images, in this case update postgres:13

  • docker-compose up -d - Detach and run containers in the background

  • docker-compose down - Stop running containers and remove them

Set up for local testing manually

  • Ever since the move to Docker and PostgreSQL this has not been as well tested, so tell us if something is wrong or confusing!

Set up PostgreSQL 13 or later (older versions aren't tested but might work).

Python 3.10 or later is required.

Install the dependencies in requirements.txt, ideally in a virtual environment.

Create a new application on Discord and add a bot.

Inside data/, create config.ini with the contents:

[Main]
token = <token for Discord bot>
database_url = <url of the database>
server_logs_url = <url to server logs database`

database_url and server_logs_url should follow a format like postgresql://user:password@ipaddr/database (example: postgresql://kurisu:[email protected]/kurisu). server_logs_url can be left blank.

Run the bot:

python3 kurisu.py

kurisu's People

Contributors

916253 avatar aspargas2 avatar bleck9999 avatar chenzw95 avatar dependabot[bot] avatar dubyadud avatar eip618 avatar el-emmo avatar elpunical avatar frozenchen avatar fyredragon69 avatar glazedbelmont avatar griffing1 avatar hiperhazz avatar ihaveamac avatar jasoncubed132 avatar jerbmega avatar jisagi avatar lifehackerhansol avatar lightsage avatar lyricly avatar noirscape avatar novaphoenix avatar pbanj avatar phazonicridley avatar pixelsergey avatar t3chnolog1c avatar thedax avatar vannybuns avatar win9x-se avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kurisu's Issues

[Bot Issue] .nickme cooldown counter is not reset when user does not have permissions

When attempting to change nickname using .nickme and the user does not have either crc or nitro booster, or there is a permissions error the cooldown counter is not reset.
I'm unsure if this is intended or not, however I'd like to think that it isn't, since there would be no need to limit how often somebody can fail to change their nickname.
from looking at the command, this should be resolved by adding ctx.command.reset_cooldown(ctx) to a newline under lines 255 and 248 in extras.py, but I could be wrong.

Video check

In commit ba6640a the filter was changed to check for youtube.com not youtube
while just checking for youtube itself is already a bad idea this change would not work if users posted a youtube link under a different TLD e.g. youtube.de.

Suggested fixes:

  1. revert back to youtube

  2. setup a proper regex that checks for real URLs and their domain

Error code 003-0399

Means "Accepted EULA version too low", basically the currently accepted eula version is lower than required. i'd add it myself but i have literally no idea how to with the changes to the err command

Add error codes

These are two uncommon error codes (text taken directly from error codes


Error Code: 009-4079
Could not access SD Card

This is an issue with the 3ds reading the sd card (needs to be sent in to be fixed) or an sd card error try using another sd card to see if that fixes it. For me this happens when trying to download an update from the home screen


Error Code: 007-0200
An error has occurred.
Please try again later.

If the problem persists, please
make a not of the error code
and visit support.nintendo.com.

This is also caused by the same thing as the other one.

As someone who has experienced this and did not know the fix because there is not one online and the bot and nintendo did not have these error codes on their website. I did not know what to do. I think this could help people know what is going on if they get these error codes as they are very uncommon

Timed auto-mute.

Stimulus: User sends x messages within y seconds.
Response: Kurisu mutes user according to procedure below:

First mute is 30 seconds; Subsequent re-mutes double the mute time, to a maximum of 64 minutes.
After the last mute, if the user is not muted again, mute counter resets after 24 hours.

implement "watch" feature

watch a user and post all of their messages into a separate channel.

this should keep track of ID and DiscordTag#0000 in a watch.json or other file

[Error Submission] Error 007-6106

Console
3DS

Error Code
007-6106

Error Description
Occurs when attempting to redownload software from eshop with an invalid/fake ticket

I dont know what is happening, when i load the bot up, this happens.

Addon "Assistance" loaded
Addon "Blah" loaded
Addon "Err" loaded
Addon "Events" loaded
Addon "Extras" loaded
Loading fc.sqlite
Addon "FriendCode" loaded
addons.kickban failed to load.
ModuleNotFoundError: No module named 'pyaes'
Addon "Load" loaded
Addon "Lockdown" loaded
Addon "Logs" loaded
addons.loop failed to load.
ModuleNotFoundError: No module named 'feedparser'
Addon "Memes" loaded
Addon "Helper_list" loaded
Addon "ModStaff" loaded
Addon "ModWarn" loaded
Addon "Modwatch" loaded
Addon "Mod" loaded
Addon "NXErr" loaded
Addon "Rules" loaded
addons.xkcdparse failed to load.
ModuleNotFoundError: No module named 'xkcd'
Bot directory: C:\Users\Alistair Deane-Wake\Desktop\Kurisu-master
NukeMusic has started! NukeFX OLD has 8 members!
Task exception was never retrieved
future: <Task finished coro=<Client._run_event() done, defined at C:\Users\Alistair Deane-Wake\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\client.py:304> exception=IndexError('tuple index out of range',)>
Traceback (most recent call last):
File "C:\Users\Alistair Deane-Wake\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\client.py", line 307, in _run_event
yield from getattr(self, event)(*args, **kwargs)
File "run.py", line 259, in on_ready
await bot.send_message(bot.helpers_channel, msg)
File "C:\Users\Alistair Deane-Wake\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\client.py", line 1144, in send_message
channel_id, guild_id = yield from self._resolve_destination(destination)
File "C:\Users\Alistair Deane-Wake\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\client.py", line 289, in _resolve_destination
raise InvalidArgument(fmt.format(destination))
discord.errors.InvalidArgument: Destination must be Channel, PrivateChannel, User, or Object. Received NoneType

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\Alistair Deane-Wake\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\client.py", line 312, in _run_event
yield from self.on_error(event, *args, **kwargs)
File "run.py", line 140, in on_error
if isinstance(args[0], commands.errors.CommandNotFound):
IndexError: tuple index out of range

command changes + suggestions

copying it here since hax wanted an issue to help ppl remember.

TheMasterOfMikeToday at 8:27 PM
An idea I do have would be to heavily alter the descriptions for each methods command on discord (as well some new commands)

.usm - If your L, R, D-Pad, and A buttons are working, and you are able to access DSiWare Data Management without crashing, do (insert usm link)

.fredtool - Only use this if either the L, R, D-Pad, and/or A button is not working. If it is working, do not use this method. You need a working DS Internet Connections tab, and a working DSiWare Data Management. If you have all of these, go to (insert fredtool guide here)

.frogtool - Only use this if your L, R, D-Pad Up, and/or A button are not working, and/or if you're unable to access your DSiWare Data Management. You will need the ability to download Pokemon Picross off the eShop in order to use that as a homebrew entry point. You also will need a working DS Download Play. If you have all these things, you can go to (insert PicHaxx/Frogtool guide here)

.slottool - Only use this if you have a broken DS Internet Connections app and have a broken DSiWare Data Management. This will require you to download Pokemon Picross from the eShop to use as a homebrew entry point. This also will require you to have working L, R, D-Pad Up, and A buttons. If these are all true, go to (Insert PicHaxx/Slottool Guide)

server image request

We're looking for a new server image when we rename "3DS Hacking" to "Nintendo Homebrew"! We are including the Wii U and Nintendo Switch. The new server image should follow a few rules, and we have some ideas too if you are not sure.

  • contains the face buttons (ABXY) or D-pad of 3DS and Wii U (and Switch if you like)
  • a general symbol for homebrew on Nintendo systems
  • your own idea!

Limitations:

  • no immediately identifiable Nintendo-owned logos
  • is not specific to one system
  • no shitpost or meme submissions

Server image must be at least 128×128. 256×256 or higher preferred. Remember the image will be cropped to a circle in most cases, so design it around this.

Please post your Discord username alongside the image, preferably in the format of DiscordTag#0000 (e.g. ihaveahax#1684).

The Enrichment Center is required to remind you that the winner will be baked, and then there will be cake.

feature suggestion: .err / .ninerr merge

valid .err codes and valid .ninerr codes do not intersect; err codes are four bytes hex, ninerr codes are in ###-#### or ##### format, for Wii U/3DS and Wii, respectively, where # is a digit [0-9].

[Error Submission] Error 160-2713

Console

Wii U

Error Code

160-2713

Error Description

The USB Storage device has been disconnected
Please reconnect it
If this persists make sure that the device gets enough power

per-channel spam checks

  • pick a certain rate of messages that normal users can't reach normally
  • if the rate is reached, lock down the channel and delete all of the messages in an array

Add error 014-0016

This error isn't really documented on Nintendo's site, though, several cases of it appearing have been spotted from time to time.

It's currently believed the issue is caused by a particular set of circumstances occurring, amounting to both 3DS consoles using the same profile and crypto. (I.E., have the same folder names in the Nintendo 3DS folder on SD, have the same friend code, same NNID, etc.)

The usual cause for this error seems to be people performing a system transfer to perform DSiwareHax, and then restoring a NAND backup made on the source console from before the transfer took place, resulting in both 3DS consoles having the same profile.

This error (014-0016) occurs during an attempted System Transfer (at the transfer of Built-In Software) from the prior target system (now the source system) back to the prior source system (now the target system) which are both using the same crypto key, and share a profile (with the target system profile being detached from the console, server-side)

The solution is to format one of the consoles, (usually the current target system) once in 3DS System Settings before attempting the transfer again. This will change the crypto key and profile to a new one, allowing the transfer to take place properly.

3DS error code 0xC82044BE returns incorrect error

Pretty simple. Kurisu says:


0xC82044BE
Module
FS (17)
Description
Failed to write file. Partition is full. (190)
Summary
Nothing happened (1)
Level
Status (25) 

However, that is incorrect. According to 3dbrew (and reality), the issue is:
Object does already exist/failed to create object.
This is a common error that occurs with ModMoon, common enough for me to write a specific note here: https://gbatemp.net/threads/modmoon-a-beautiful-simple-and-compact-mods-manager-for-the-nintendo-3ds.519080/ and do large amounts of error checking here: https://github.com/Swiftloke/ModMoon/blob/master/source/main.cpp#L539 and here: https://github.com/Swiftloke/ModMoon/blob/master/source/utils.cpp#L283 and here: https://github.com/Swiftloke/ModMoon/blob/master/source/main.cpp#L729 . The issue becomes present when, attempting to move folders, the destination folder already exists. It was not pleasant to realize that the bot was incorrect about this back in July 2018, and someone brought it up again just now.

.warn change

For second offense, add a 30 minute mute on top of the warning.

Fifth offense is auto ban.

Logo

pic

Cody090909#6599

(Improvement) Consoles Hacked Tracker

I'd be super cool and moral boosting if we had some sort of command, that tracks how many times we've helped hack a console. Something like .success that can only be used once a day?

[Error Submission] Error 155-0209

Console

Wiiu

Error Code

155-0209

Error Description

The meta.xml file could not be loaded because its format was invalid.

raised when the XML does not pass the verification

does not normally occurs with a a normal WiiU Use but it's intresting

also 155-0210 is when there is no meta.xml at all

Error handling for takehelp

Currently no error handling for using takehelp on users who already lost help. Edge case? Sure. But still there

[Error Submission] 002-0110

Console

New 2DS XL

Error Code

002-0110

Error Description

This error displays when you attempt to access the YouTube app after September 3rd, 2019. You must access YouTube via the browser on a New 3DS/New 2DS.

.vguides command too big

Hi,

I believe the .vguides command is too big and has a lot of unnecessary sentences, spacing, and lines. It should be revised with a smaller embed like this
chrome_2017-10-20_19-40-05

[Error Submission] Error 150-3032

Console: WiiU
Error Code: 150-3032
Error Description: PERMISSION_ERROR

When the system tried to access files mapped to NAND that was copied from RedNAND to SysNAND a permission error occurred.
See the log at: https://pastebin.com/S81kApYg (up for 1 year from today)
I do not know if more errors are mapped to this number.

[Error Submission] Error 007-2001

Console
3DS

Error Code
007-2001

Error Description
Attempting to access eshop on a region changed console (fixed by region changing back to the original region, or restoring a nand backup made before the region change)

(resubmitting because .err 007-2001 didn't show this info)

"Your support description appears to be unknown" on 3DS is replicatable in one way

I had issues with my o2DS with error codes which Kurisu describes those with said message and the app that caused these was the eShop/MINT applet.

I have told about how I fixed it on the HB-Discord yesterday.

Basically, whether you'd use the DevUnit "Config" program or write a homebrew capable of changing the system settings,
if the language setting happens to become invalid (like 0xF, "undefined") Nintendo servers refuse to connect to this 3DS with this bugged out setting. Not even some MK7 WWs are possible. Friend list still works though.

There may be other reasons that would originate from corrupted settings.

The way to fix it (in this case) is to change the language back in System Settings.
(If English is the language to switch to, select another one before tapping English since the 3DS does only default text strings to English.)
↑ Because of this requiring the languages option, JPN, CHN, TWN and KOR consoles have to rely on a homebrew program to switch it back since the System Settings on those consoles don't have a visible language setting.

I have to be honest here: This is not common whatsoever. However, there may (and even are) homebrew apps that screw with consoles rather than do what they were advertised to.

Ofc I have full guilt for this problem on my o2DS since I downloaded a random (kinda sus) homebrew without asking if it's actually OK to use but it was interesting to discover and examine this error nontheless.

Add resettoggles command.

Usage: .resettoggles #channel
Resets all .togglechannel channel membership toggles off, for a specified channel.
Use this to clear membership of an opt-in or opt-out channel.

Add estimated membercount after pruning.

Usage: .activecount [days]
Shows the number of members active in the past [days].
Works like the inverse of .estprune, subtracting the pruned estimate from member count.
(thanks FrozenFire for the idea!)

Downloading Error Codes

Copied from Reddit: When there is something wrong with the eshop (servers of nintendo) you can expect the following codes:

007-2916
007-2913
009-2916
009-2913

As I can read in another reaction of yours you've had this error code. So please wait and try again later.

[Error Submission] Error 022-2591

Console

3DS

Error Code

022-2591

Error Description

Attempting to log into an NNID that is already linked with another 3DS console. Happens in NNID settings, if that wasn't clear.

Kurisu reply if DM block

Possibly have Kurisu reply in the channel a message was deleted if DMs are diabled to inform the person why the message was deleted

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.