shikhir-arora / NadekoBot

General purpose discord chat bot written in C# using Discord.net library.
MIT License
3 stars 2 forks source link

Running the latest: indev-2 [Fixes: Music, .die startup lock - Adds: Optimize Program-O on LEMP with TLS, Quote Extensions, Remove(s): .rrc for high API abuse potential, UserPresence logging disabled for high API abuse potential -> frequent ratelimiting] #32

Closed shikhir-arora closed 7 years ago

shikhir-arora commented 7 years ago

indev-2 is always the latest and tested to work. Default branch of my fork. This is for anyone who is interested. Despite indev-2 it is tested well before updating.


indev-2 safe / seamless updating (detailed version)

https://github.com/shikhir-arora/NadekoBot/tree/indev-2 the indev-2 branch is always up-to-date with NadekoBot/dev (official dev branch) with the stable voice updates in Kwoth#1139 .

To get the indev-2 tree, run the following in your home directory (where linuxAIO.sh is): (Linux)

(1) wget https://gist.githubusercontent.com/shikhir-arora/6b448ae2c07a890f08c422936f61256c/raw/60ecba4cfaaa7d1a386453d73fe8974068187560/mod_dev.sh && bash mod_dev.sh (you can split these up but the && will download and execute the script on Linux)

(2) This will update Nadeko to the indev-2 tree. (Just a modified version of the updater script), [pulling git clone -b indev-2 --recursive --depth 1 https://github.com/shikhir-arora/NadekoBot.git (the indev-2 branch)] [Don't worry about this second or third point below, just for explanation!]

(3) mod_dev.sh is the command linuxAIO.sh runs to update Nadeko to the latest development build. You can view it with the link above. The only difference is that this pulls my indev-2 branch instead of dev, but again they are kept up-to-date.

The below is an example of how to do it seamlessly: NadekoARN.sh is the exact same script that is called when you choose .die and auto-restart without auto-updating option. Once one runs the commands below, they only need to bash mod_dev.sh locally to update their bot with indev-2 as needed and, to start it up again, bash NadekoARN.sh (these are all parts of linuxAIO.sh


indev-2 get - short version, just show me the commands! Just 4 commands:


vlexar@node1:~$ cd main/vlexar 

vlexar@node1:~/main/vlexar$ wget https://gist.githubusercontent.com/shikhir-arora/6b448ae2c07a890f08c422936f61256c/raw/60ecba4cfaaa7d1a386453d73fe8974068187560/mod_dev.sh && wget https://raw.githubusercontent.com/miraai/NadekoBot-BashScript/master/NadekoARN.sh && bash mod_dev.sh 

vlexar@node1:~/main/vlexar$ tmux new -s BotName

vlexar@node1:~/main/vlexar$ bash NadekoARN.sh 

Differences Explained: (see commit log at bottom thread for overview)

LINK to the API with a test call: https://nadeko.link/nadekochat/chatbot/conversation_start.php?bot_id=1&say=Who%20designed%20you?

(it is managed under https://nadeko.link) I have messaged Kwoth the information for the admin panel as well several days ago.

-Fork is Updated with the latest updates from dev and all command/response strings are kept up-to date. The dev branch here tracks the parent dev branch. The b2 branch tracks the parent 1.4 branch. All updates that are stable and tested go here.


Why? / Tasks [See Commit Log at the bottom for a quick table]

This is the version that I run, which solves many problems, aims to meet Discord API compliance for ratelimits, etc., and adds a few features:


Reasoning for Music

I think that is all right now. This post will be updated as necessary. I don't have the time to fully rewrite the music module right now as it needs some major changes which are better suited to a full rewrite, and the above fixes have been in place for weeks now here. 👍

I could explain my reasoning further with regards to Music, but it boils down to several things: a) it is not a stable thing to have a bot connected to voice channels for that long, both from a Discord API standpoint and from a stability/reasonable feature perspective especially when it is paused or has queued, stagnant music, and b) there are a lot of tiny changes with Discord.NET since the module was written, and the custom fork Nadeko uses may need some updates as we have a clearer way of audio handling now, and c) it is most important to move away from Google's API just because this is very slow, causes a lot of issues and limits several things. There are several sections that are using pretty antiquated techniques (many marked todo: from a long time ago) which cause a lot of overhead, unfortunately, so again this requires a rewrite over anything, which takes some time.

Feel free to shoot me any questions. Thanks!


shikhir-arora commented 7 years ago

Commit Changes and appropriate information/reasoning. (Updated 10 May 2017)

Date(s) Commit(s) Description
26 March 2017 529343ceb6469ebc25a9fdc3aab1796f2785126e [Bugfix]: playlist bug where song would be added to the queue at the last index when repeatplaylist was enabled with repeatsong, as the ActionQueue events are not mutually independent
19 March 2017 - 02 April 2017 bf913030325444662446ee7c72c8b1c7b708e5c2 + 0c8fc55f00cfed570367914cdea3f7c6660ce11d + c635bdcd3c4a975e1066e43133ad15a817aef0c1 [Bugfix/Core Audio Fix]: modified !!move and related logic to fix the lock completely and disconnection timeout/no responses referenced. Added buffer command for [OwnerOnly] to manually initiate a rebuffer if needed. Care taken to ensure that no playlist metadata (position, playlist tracks, etc.) are lost, even after heavy testing. This closes most issues from Kwoth/NadekoBot#1053 and the realistic next steps would be a full rewrite of that module, which is a large task to refactor.
05 April 2017 d00ec1e51cf7b27afef1caa19d5ec7b078e9ce83 Added: CleverBot Program-O (same as parent), on LEMP stack with https vs. slower public API on an Apache system with no TLS
10 April 2017 10170e6f9c4af826863c2ffa31d4c8c93d259777 + cbc2599b6fec03e8045a8a921d189a244148a6a8 + ef6dc339199742a0b6b955cf9a52d7fa113c94e9 Added: .listquoteskwd command to supplement the .quoteid to search by quote ID. Some users have 100's of pages of quotes, so it makes sense to be able to filter the quote ID list for a specific keyword (which are searchable from the .quoteid feature I added and was pushed to the parent/dev branch)
11 April 2017 d570992f8adf43aa7370e050a6f5f38a766d5111 [Bugfix/Lock]: .die on startup by ignoring that as a valid startup command. .die (auto-restarts bot, with/without updates depending on your config) will cause the bot to go into a deadlock and loop until either it gets ratelimited and disconnects from the gateway, user catches it and can terminate the process, or until SIGINT is sent to kill signal
30 April 2017 0648a2c47098e1af6224e51823194bc5b115c0d8 [API/Compliance]: Disables .rrc commands. My comments on the commit: "Yes, these are [OwnerOnly] issued, if someone uses them responsibly it is fine (with maybe their own user role with 1-2 people), but I can see there's too much spam potential here, which counts more than functionality, especially when a role can have thousands of users updating that many will certainly trigger ratelimits, and not a great thing to have that option there for those who don't care about the ratelimits."
10 May 2017 b4b88fa0a9381d197fc80a3459280fed72fcefa0 [API/Compliance]: Disabled logging only UserPresence (online, offline, idle) updates, as these spew ratelimit issues all over the place. This is stopping the log capability from being used in multiple guilds effectively, which should be no issue, but the UserPresence updates means that there can only be one logged server, and even that is hit or miss depending on the size. Even with small servers, it is very easy to hit the ratelimit. From April 20-May 10, there were 30 cases of hitting the ratelimit, all specifically on the UserPresence within the LogCommand. on a single, small Discord server of just 40 users. An example: 23:47:25 LogCommand Discord.Net.RateLimitedException: You are being rate limited. This has been well known for a while, and, besides making it a bottleneck for logging otherwise, this is a pretty big issue. On another note, I don't see the need to log UserPresence (online, idle, offline) - if such a thing is needed, a special app should be used to do so, not 'spamming' presence updates.