Giter Site home page Giter Site logo

rabot's Introduction

RetroAchievements.org Discord Bot

๐Ÿค– RABot is the official RetroAchievements Discord bot. If you wanna see it in action, join the server and type !help.

The code is written in JavaScript and is powered by discord.js library and Commando framework.

If you are used to those technologies and would like to contribute, PRs are welcome!

Documentation / FAQ

๐Ÿ“ Requirements

  • Node.js 16+

Install:wrench::hammer:

To install the project run the following command:

$ npm i

Fetch game lists and add a badwords file

$ bash util/getgamelist.sh
$ echo "[]" > assets/json/badwordsRule2.json

Run ๐Ÿ’ป

Set the .env file properly and then:

Production

$ node index.js

Development

To run the bot for development which includes hot-reload, please use the following command:

$ npm run dev

๐Ÿ“š Inspiration

Many inspiration for RABot was obtained from the Xiao bot's code.


โ„น๏ธ For any issues please raise a ticket.

rabot's People

Contributors

amine4567 avatar dependabot[bot] avatar kdecks avatar luchaos avatar meleu avatar mrownership avatar televandalist avatar wescopeland avatar zapobyte avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rabot's Issues

Autonomous bot

The bot is useful and fun but it must be invoked by the users. It might be a cool idea to give the bot a mind of its own.

Some concepts:

  1. The bot as a conversation starter. Perhaps the bot could look for a pause in #casual conversation that lasts more than 3 hours. When the threshold is reached the bot could randomly drop a memefact or funfact. Some rng could be used to make the interval more unexpected.

  2. The playful bot. There could be a similar script in botspam where the bot could recommend a random game. "I'm bored, anybody wanna play a game of "!Akinator" with me?"

  3. The bot as an interrupter. Whenever "several people are typing" the bot could have a 1 in 10 chance of butting in on the conversation with an ill advised meme.

Request: Translation Command

I want to have a translation command which works like "!translation en it Hello" or something like this to translate specific words or sentences.

define a Coding Style

When I started RABot I wasn't a "JavaScript guy" and never cared that much about the coding style. I just followed what I used to do with C code mixed with old RAWeb's PHP code, which also doesn't have a defined styled...

It turns out that now I'm not happy with my own JS coding style here and I'm noticing RABot's code is becoming a bit messy.

After googling about JavaScript coding styles the one I liked most is this one from airbnb:
https://github.com/airbnb/javascript

I would like to know your opinions @vzapo and @luchaos (but please, do not suggest using a semicolon-less style).

Longplays from youtube

Add function which allow the chosen game entry to be used to generate a youtube like for longplay video.

Hub related info in !gan command

As we all know, "!gan [game ID]" generates ready to use post for announcing a set in "#Achievement News" channel

The issue is that the change in this update caused a minor issue, since now, the genre info is taken not only from the text field, but also from the similar games "Genre/Subgenre" hubs, which makes the posts look like this
unknown

The genre which is after "NES," should be "2D Platforming" as you can see on this game page

The best fix in my opinion would be using the same solution the game pages are currently using

Random cheevo

Can we have any bot command/or web bot, which will choose random achievement from your started games to hardcore?

Translating Cheat Codes into Memory Addresses

I would like to have a command which allows me to add a console, the used cheat engine and the cheat code into a message and the bot tells me which memories are used in the cheat code and what size (converted to RA memory viewer). This command would make it easier to find memories for developers when developing a set.

For example a developer wants to find the map ID memory and they can just type the cheat which loads a specific map into the message and then the bot tells them the few memories which are included in the cheat code and could be the memory they are looking for. In the most cases that would reduce the possible amount of memories to less than 10 which are fairly easy to test.

As a command I have something like this in mind:

Input:
!translateCheat "Gameboy" "GameShark" "0100FAC2 0100FBC2 0100FCC2 0100FDC2"

Output:

@SporyTike
0xC2FA (8-bit)
0xC2FB (8-bit)
0xC2FC (8-bit)
0xC2FD (8-bit)

That's just an example for GameShark for the Gameboy. Of course every console and cheat engine behaves different so this could be a command which improves and gets more consoles featured over time because someone needs to find the time to understand the logic behind them.

Mem command reading leaderboards

Like the !mem command can be used with an achievement link to see the logic and code notes I would like to see an addon to this feature which allows using leaderboard links as well (or maybe something like !mem leaderboard:XXXX - XXXX for the leaderboard ID) so you can get a better view of leaderboard logic and the code notes.
At the moment it's a small pain to check the logic of a leaderboard and this command is perfect for getting a better view if you want to find an issue within the code.

Calc command can't use comma

The calc command can use non-full numbers by putting a point in the number (e.g. 1.25 (5/4)). In some languages it is common to use a comma instead of a dot so the number looks like 1,25.

At the moment if you type or paste in a number with comma you get an error that the message can't be read including which char is wrong and you need to correct the comma. It would be nice to see that the bot accepts the comma and transforms it to a dot automatically before the calculation.

Request: Calculator command

I would like to have a calculator command so I can calculate big numbers directly on Discord instead of using an extra device or opening an extra page.

Hidden Vote concept

One problem with some voting that is seeing what others are voting for influences one's own vote. Here's a concept that could work to remove this problem.

A vote would be started in the same way as other !vote commands, but instead of reaction a voter would type their selection, as in 1, 2, 3, etc. The bot would delete what the user has typed, and the vote would be recorded. If a user types a different value, the vote would be recast.

If you could get all that to actually work, the only drawback I'd see for this kind of vote is that only one could be held in a channel at one time.

Have bot greet new Discord members

Have the bot send a PM to new Discord members that tells them how to get verified and why. I can make a write up something for this or make a gif, if you decide to code it.

Role and nickname preservation after rejoining server

Every once in a while it happens that a user leaves on purpose or accident from the Discord server and then rejoins. Discord always "erases" all roles and the nickname a user has when they leave the server, which requires them to send a new verification request again when rejoining.
Carl-bot (already on our Discord server) has a nice feature that saves all roles a user had when leaving and gives all of them back as soon the user rejoins, you can also exclude specific roles like Admin, Mod or AotW-Winner to prevent users getting these specific ones back. The issue with Carl-bot however is, that it doesn't save the nickname a user had which makes the auto-assignment of the Verified role problematic because some Mod still needs to dig logs to see what account the user verified with and do a manual renaming.

I would like to request a feature for RABot that preserves specific roles of users + their nickname if they have one to make the re-verification of users full-automatic on rejoin.

Additionally, it would be good to have a command that allows users with the roles Mod or Admin to add and remove role exceptions of roles that a user gets back when rejoining, so it doesn't require a bot update when an exception is added or removed.

meme board moderation

@vzapo it's great to have the RA Meme System:tm: accepting new entries again, thanks for that! :heart:

But I noticed that the mod reaction with ๐Ÿšซ isn't working as it was when I implemented it.

The idea is when a mod react to a message with ๐Ÿšซ:

  • if a message isn't on the memeboard yet, it won't be, no matter how many ๐Ÿค– reactions it has
  • if a message is already on the memeboard, it'll be deleted.

!botgames command to list all games commands that can be used

Current games commands

!akinator - starts an Akinator guess the celebrity game
#!Acrophobia - starts a game of Acrophobia
|help - evokes the chessbot command list for a chess game
|newgame [playername] challenge another user in chess
#!JumbledWord - creates a jumbled word mini-game that waits for the correct un-jumbling
#!TypingGame - creates a typing game race. First to finish wins.
#!Trivia - asks a trivia question. First answer will give a correct/incorrect response
#!ThisOrThat - asks a this or that type question to evoke conversation
#!WouldYouRather - asks a Would You Rather type question to evoke conversation
#!Magic8ball [Question not in brackets] - Gives a Magic-8-ball type response
#!RPS [type rock paper or scissors after RPS] - Gives a Rock, Paper, Scissors type response

Value to Time Command

I would like to have a command which can be used to get the time in either ''Milliseconds'' or Frames. I tried to find something in the internet but couldn't find anything I would like to use. I want a command where I can say which time format it uses and if I type something like:
!command frames 0x11e0
the bot answers with an output like
4576 Frames have the Time 1:16.26

Also it should be possible to type
!command frames 1:16.26
and get the answer
The Time 1:16.26 has 4576 Frames

Same with site Millisecs format (100 = 1sec) and if possible with Hex and Dec format support. It can be used to get timer value from memory easier by searching for exact numbers and it's also easier to create default times for leaderboards. Also it could help to fix broken leaderboards.

Feature Request: Custom mastery messages for specific games

I would like a feature for developers to add their own mastery messages for specific games. Games so far include the NES and SNES burn-ins, Mario Series, Final Fantasy series and Color a Dinosaur.

For example:

"Yabba-Dabba-Doo! [User] has mastered The Flinstones for Master System!"

"[User] has mastered Kaboom! for Atari 2600! Three cheers for the bucket brigade!"

"[User] has kicked some tail and mastered Gex 3: Deep Cover Gecko for N64!"

[suggestion] identify number of random !meme

when someone uses an existing number it shows "meme #x".
Using no number, or a non-existing number, it displays "random meme".

A slight improvement would be to show the number AND that it was random, such as "meme #x (random)"

Improvements for !parsemem

1. DONE! If the argument is an achievement URL, parse the "Mem" of the achievement

example: !mem https://retroachievements.org/achievement/9413
improvement: !mem ach=9413

2. DONE! Make it accept a string as the address/value

example: !mem 0xHlevel=N
output something like:

1: Mem 8-bit 0xlevel = N

Note:

  • string length must be limited
  • ???

3. DONE! Make it have some aliases for templates

example: !mem finishlevel

request: Player card command

When ``!user [name] is typed some data points are pulled up.

Here's some ideas for data points:

  • rank
  • score
  • last game played or last seen doing...
  • member since
  • player profile image
  • motto
  • account type

Add command !manual unlock

Have it link directly to this pin.

I am aware there is a way to use the bot to lookup the FAQ, I believe this is a bit smoother.

Features list ?

Hey guys,

I looked over the bot a bit and other issues/suggestions and thought about the following things to implement next:

  1. Bot announcing different winners of different events.
  • I would think to implement it one of the 2 following ways:
    1.1. If done automatically presumably it would have to pull some endpoint data on the event on a time basis
    1.2. to do it daily once, at given time an announcement with the players who won in the current day
    Both ways would need a feed from which I could import it,if any of you guys could point out where i could get the info, would be grateful :)
  1. Not sure it is worth but a kick/ban command from discord and also from site ? if it's worth would have thought to implement it something like:
    2.1. for ban for example !ban discorduser websiteuser could work to both him from one or both sites in case he was a cheater or abuse,etc
    2.2. for kick !kick discorduser

  2. Might worth implementing a mute command for people that do not behave and have some sort of warning before getting kick/ban ?
    3.1. to implement a mute thing, i was thinking to create a mute role that has no text permissions which the bot will add
    3.2. to unmute it can add a timer or a manual unmute must be done, one of the 2... or some other idea

From other issues/features open I could also add the following:

  • implementing different/multi prefix. This is not really feasible in the current state using Commando Framework. i tried a hacky way to implement this by catching the command before it was executed but it ended up to ugly to implement in the long run and didn't worked as expected...
    this is due to the fact that Commando framework implements the prefix automatically with ! if not defined and if it is defined will accept only plain strings,not even regex can work... might worth look into it later(#1)
  • giving the bot some AI :) (#29). This could be done in multiple ways, but one i guess one easy way would be to add Dialogflow form Google or maybe other one like IBM Watson or Amazon LEX?... would incline thou for Dialogflow it;'s a bit more easy to use in my opinion, but wouldn't put it as a priority this really :)
  • hidden vote concept(#30) I could also work on this if it's still needed and not done
  • verify @mention to verify new users (only for mods) & setaotw @mention to give "aotw winner"(or give any and remove any roles?!?)
    (#1) I could also do this but would need somebody to tell me where can I make a request for this (the endpoint that is accepting it?)

If you think any of this sounds good or have anything else, any other ideas I'm up for it... If I can handle it.
Waiting for your feedback :) ๐Ÿ‘

Auto-Publish for Announcement Channels

On Discord we use announcement channels (currently community-news and achievement-news) so users can subscribe to these with their servers and get the messages there too when they get published on our Discord server.

By default the message-writer or a mod needs to manually publish each message by clicking on the publish-button and sadly many either don't know about it or simply forget it. I would like to request a feature for RABot so he automatically publishs any message that is sent in these channels so nothing is missed.

Automated Voting Options

We have our revision-voting channel on Discord. Normally we use emotes like thumbsup and thumbsdown or the letters A, B, C to start a voting. Sometimes it happens someone reacts too fast while the creator of the voting still prepares the reactions and the reactions get shuffeled. In such cases the voting is invalid because it can confuse the people when it's not the standard.

Furthermore, users like Thoreau, which upload the votings from forums, lose their possibility to give their own voting feedback because they need to set the reactions.

It would be nice if the bot could check the message of the voting and react to the message right when it was posted with the correct voting options. My idea would be that it checks the message for emotes and reacts with the same emotes in the order they appear or - in cases there are no emotes in the message - adds thumbsup or thumbsdown as a default.

Add an in/opt out command for devs only for @revision-voting & @dev-news roles

As a Discord moderator, I want users to only get pinged for news if they are interested.

We don't add these two roles because it's difficult to track who's got what, and who opted out of what, or was just never given the role.

Also, we've already discussed the @revision-voting role before. Figured I'd put it briefly on the docket.

Feature Request - Commands for Tickets

Would like to see some commands for ticket info. Some examples:

  • For seeing ticket totals per game: !gametickets 341 (341 being the game ID)

Final Fantasy III (U) | Final Fantasy VI (J) (SNES)
Total Open Tickets: 56
Total Closed Tickets: 26
Total Resolved Tickets: 68
Overall Total Tickets: 150

  • For seeing ticket totals per achievement: !achtickets 6001 (6001 being the ach ID)

The World is Yours
Total Open Tickets: 6
Total Closed Tickets: 3
Total Resolved Tickets: 6
Overall Total Tickets: 15

  • For seeing a user's current open tickets: !usertickets televandalist

televandalist
Total Open Tickets: 1
Total Closed Tickets: 114
Total Resolved Tickets: 332
Overall Total Tickets: 447

  • For seeing ten most recent tickets: !tickets recent

29194 - Adding Fuel to the Fire - Developer: MeCKooLL - Reporter: Ragengow - 27 Jun 2020, 17:55
29193 - Gambling Addict - Developer: Blazekickn - Reporter: Jdk2222 - 27 Jun 2020, 17:24
etc.

  • For seeing ten most reported games: !tickets most

Final Fantasy Tactics Advance - 76
Final Fantasy III (U) | Final Fantasy VI (J) - 56
Golden Sun - 47
Harvest Moon - 34
Legend of Zelda, The: The Minish Cap - 34
Faxanadu - 22
Rhythm Tengoku - 16
Gradius III - 16
Super Mario RPG - 13
Boktai 2 - 13
More...

Maybe something for displaying a ticket karma leaderboard, too ๐Ÿค”

!mem command improvement

When you invoke the !mem command the bot will interpret the inputted achievement logic and output achievement conditions in a more readable form as presented in the achievement editor.

I've noticed that some logic flags do not display properly, in that they do not omit the operator and value/address/hits to the right of the operator.

!mem B:d0xh80dc=2_0xh80dc=2

Current ouput:
Screenshot_20210110-211143_Discord

Expected output:
image

Logic flags which should produce this behavior but do not:

Add Source
SubSource
AddAddress

Command: Memory Difference

With the more or less new toolkit version which added AddAddress there is one major problem when coming up with pointers: It's needed to know the differences between memories. I would like to have such a command which works like this:

Input:
!memDiff 0x181320 0x18eb54

Output:
0x181320 - 0x18eb54 = -0xD834

Gan-Command autofills Name

Currently when using the command !gan <GameID> you get a template you can use for achievements-news. However currently when using it one info is missing and needs to be set manually everytime. The command always outputs A new set was published by @{AUTHOR_NAME} on ....

It would be nice if the @{AUTHOR_NAME} would be replaced with a ping of the user who used the command. The idea of the template is to just copy and paste it and so it's likely a person misses to replace it, also it's kind of strange that the date is always the current date because with that logic it should be {DATE} as well.
Because there are only two situations in which this command is used: Either by the set developer themselves OR someone who does the news like Hotscrock who would need to replace the @{AUTHOR_NAME} anyway it would be nice that at least the devs who do the news themselves save a few seconds of typing.

ToDo list

TODO

  • announce the aotw winners in the #aotw channel (check API_GetAchievementOfTheWeek.php periodically).
  • setaotw @mention to give "aotw winner" role to a user (only for mods).
  • purgeaotw to remove "aotw winner" role from everyone (only for mods).
  • verify @mention to verify new users (only for mods)
  • [NOT REALLY SURE] emoji commands, like emoji and emoji-list.
  • [NOT REALLY SURE] make all commands have options like -h, --help, /h, etc. and make them reply with the same output as !help command.

DONE

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.