Giter Club home page Giter Club logo

jaredvirtualmachine's Introduction

JaredVirtualMachine

stability shield usability shield green shield

Why Jared Virtual Machine?

You see, I had a dream... That I could stop abandoning projects as soon as I started them...

While this dream is most certainly still a wild fever dream, I wanted to practice my Java by applying it to a bot. The problem with a previous bot I tried to make (PeaScript) was that I, at least at the time, was fairly new and inexperienced to JavaScript. Made it very hard to develop anything past a bot that enjoyed responding to messages.

By using the Java Discord API, I can build a slightly more complex bot that I'd like to use on my actual Discord server without the navigation, syntax, and just general confusion that comes from being too unfamiliar with a language.

Oh also, the name "Jared Virtual Machine" is a play on Java Virtual Machine so yeah!


Functionality

Warning

This bot exists for personal use! If you take it and use it, use at your own risk.

!ping

  • Pong!

/vc-invite <user>

  • Used for people who have permission to join a voice channel, but their friends don't have the required permission.
  • Both users must be connected to a Voice Channel and then the person with permission can invite the other to the channel.
  • Uses fancy buttons for interactions and handling the invite requests.

/abby

  • We have a friend with a cute dog.
  • The command gives us easy access to Abby pictures.
  • The pictures are saved and pulled from this repository!
  • Supports .mp4 videos, albeit not the way I want it.
    • Sent as a normal message, not as an embed.

/valorant profile <valorantName>

  • Fetches some data about the Valorant account.
  • valorantName should look like Peashooter101#7016.
  • Special Thanks to Henrik for their Valorant API.

Pin Message

  • This was a Feature Request.
  • Accessed through the Context Menu (right-click Message).
  • Works only for individuals with the Administrator Permission.
  • Sends to the top most text channel with a "๐Ÿ“Œ" in its name.

Planned Functionality

/vc <invite/request> <user>

  • Change the format of the command to have two subcommands.
  • /vc request should be the same as /vc invite but they are requesting permission to join.
  • Make it look fancy using Embeds cause Embeds are cooler.

/abby <search/gallery>

  • Need commands to do other additional stuff.

/valorant <profile/rank/history/skins>

  • For the account level, draw the level onto the border rather than using their "Level Tier" for the border.
  • Pull detailed ranked data for the given episode in /valorant rank.
    • Provide an optional argument for Episode / Act.
  • Pull and generate match history data for /valorant history.
  • Consider caching the data locally somehow... ๐Ÿค”
  • Pull and display weapon skin stuff with /valorant skins <skinName>
    • Might need to use a database for this one chief... There are a lot of skins...
    • Consider using Valorant-API for in-game content for this command.

/<game>

  • Similar to the /valorant command, pull game information depending on the game.
  • Not a priority since most related practice will be done on the /valorant command.

/meme <memeID> <topText> <bottomText>

  • Create a meme format!

<Some text you sent>

  • The bot responds to messages you send sometimes, with somewhat related responses.
    • The Easy Route: Use the Sentiment Analysis or other Microsoft AI services.
    • The Hard Route: Decide to figure out what's "related" on your own.

Pin Message

  • Add functionality to request or vote pin if you do not have permission.
  • Edit so the permissions extend to people who have the ability to pin messages too (duh... but it's late at night right now).
  • Figure out if there is a way to embed videos to these pinned embeds.
  • Allow links that direct to an image to put the image into the Embed Image (Feature Request).

/defenestrate <content>

  • Throw them out a window.

Experimentation

I created a little playground to keep track of some experiments I am conducting in relation to this project. Think of it as a place for me to store my practice runs without having to force the bot to run. Some of the early experimentation may not be present in the Experimentation Package since I made this a few weeks after initially starting the project.

You can find the Experimentation Package here.

Note

This is meant to be a playground and will not be updated for any reason outside of me doing random tests.

It is under the test directory, but it is located within experimentation because I am not trying to test the application.

Some experiments I have conducted...

  • Using HttpRequest, HttpResponse, and HttpClient for GET/POST requests.
  • Using Jackson API to map JSON into Objects.
  • Merging, scaling, and modifying images using BufferedImage and Graphics (OverlayImagesExp.java).
  • Converting a BufferedImage into a Base64 String and sending that info up to Imgur (ImgurUploadTest.java).
  • Pull apart a GIF and overlay text onto it (TextOnGifTest.java).

Some ideas I have...


Demo Images

Wanna see some of the stuff without using the bot? ๐Ÿ˜„

/abby

Abby Demo

/vc-invite <@user>

Voice Chat Invite Demo

/valorant profile <user>

Valorant Profile Demo

Pin Message

Pin Message Demo

jaredvirtualmachine's People

Contributors

peashooter101 avatar rhythmicsys avatar

Stargazers

 avatar

Watchers

 avatar

jaredvirtualmachine's Issues

Feature Request: `/pin <message link>`

Imagined functionality:
Set a pins channel, or it will default to the channel the command is run in
This would create and send a webhook message using

  • Author's Icon
  • Author's Name
  • Embed with
    • Color of the author's highest role color
    • Message content
    • Timestamp of the original message
    • Button that links to the original message
    • Field that shows the message is a pinned message (or another way to show that the message is a pinned message/webhook message)
    • Possibly a 'Pinned by on '

Visual example of this

Original message:

image

Idea of what a pinned message would look like:

image

ValorantRank: images field is null sometimes.

Problem

Sometimes (not often) the ValorantRank fails to have an internal Images class, sometimes this is set to null.

  • This should not occur on a status 200 response, the behavior is unexpected.

The command used was /valorant profile user:Peashooter101#7016

  • The resulting command fails since this is an unhandled exception.

Expected Values

The URL to retrieve data on user Peashooter101#7016 is https://api.henrikdev.xyz/valorant/v2/mmr/na/Peashooter101/7016 .

The following JSON is the output received using Henrik's tool found here: https://docs.henrikdev.xyz/valorant.html

On a 200 HTTP Status Code, this is the expected return value for Peashooter101#7016...

The by_season field was removed from this paste as it is not relevant to the issue and, as of right now, is ignored by the ObjectMapper.

{
  "status": 200,
  "data": {
    "name": "Peashooter101",
    "tag": "7016",
    "puuid": "7bc539b0-e68f-51f5-98bd-5377a9e2c50a",
    "current_data": {
      "currenttier": 14,
      "currenttierpatched": "Gold 3",
      "images": {
        "small": "https://media.valorant-api.com/competitivetiers/03621f52-342b-cf4e-4f86-9350a49c6d04/14/smallicon.png",
        "large": "https://media.valorant-api.com/competitivetiers/03621f52-342b-cf4e-4f86-9350a49c6d04/14/largeicon.png",
        "triangle_down": "https://media.valorant-api.com/competitivetiers/03621f52-342b-cf4e-4f86-9350a49c6d04/14/ranktriangledownicon.png",
        "triangle_up": "https://media.valorant-api.com/competitivetiers/03621f52-342b-cf4e-4f86-9350a49c6d04/14/ranktriangleupicon.png"
      },
      "ranking_in_tier": 64,
      "mmr_change_to_last_game": 30,
      "elo": 1164,
      "games_needed_for_rating": 1,
      "old": false
    },
    "by_season": { }
  }
}

Error

Console Error and Stacktrace
20:36:49.455 JDA MainWS-ReadThread                         JDA             ERROR  One of the EventListeners had an uncaught exception
java.lang.NullPointerException: Cannot read field "large" because "rankData.current_data.images" is null
        at com.Peashooter101.jaredvm.listeners.command.ValorantListener.profile(ValorantListener.java:113)
        at com.Peashooter101.jaredvm.listeners.command.ValorantListener.onSlashCommandInteraction(ValorantListener.java:40)
        at net.dv8tion.jda.api.hooks.ListenerAdapter.onEvent(ListenerAdapter.java:382)
        at net.dv8tion.jda.api.hooks.InterfacedEventManager.handle(InterfacedEventManager.java:96)
        at net.dv8tion.jda.internal.hooks.EventManagerProxy.handleInternally(EventManagerProxy.java:88)
        at net.dv8tion.jda.internal.hooks.EventManagerProxy.handle(EventManagerProxy.java:70)
        at net.dv8tion.jda.internal.JDAImpl.handleEvent(JDAImpl.java:170)
        at net.dv8tion.jda.internal.handle.InteractionCreateHandler.handleCommand(InteractionCreateHandler.java:109)
        at net.dv8tion.jda.internal.handle.InteractionCreateHandler.handleInternally(InteractionCreateHandler.java:80)
        at net.dv8tion.jda.internal.handle.SocketHandler.handle(SocketHandler.java:39)
        at net.dv8tion.jda.internal.requests.WebSocketClient.onDispatch(WebSocketClient.java:953)
        at net.dv8tion.jda.internal.requests.WebSocketClient.onEvent(WebSocketClient.java:840)
        at net.dv8tion.jda.internal.requests.WebSocketClient.handleEvent(WebSocketClient.java:818)
        at net.dv8tion.jda.internal.requests.WebSocketClient.onBinaryMessage(WebSocketClient.java:992)
        at com.neovisionaries.ws.client.ListenerManager.callOnBinaryMessage(ListenerManager.java:385)
        at com.neovisionaries.ws.client.ReadingThread.callOnBinaryMessage(ReadingThread.java:276)
        at com.neovisionaries.ws.client.ReadingThread.handleBinaryFrame(ReadingThread.java:996)
        at com.neovisionaries.ws.client.ReadingThread.handleFrame(ReadingThread.java:755)
        at com.neovisionaries.ws.client.ReadingThread.main(ReadingThread.java:108)
        at com.neovisionaries.ws.client.ReadingThread.runMain(ReadingThread.java:64)
        at com.neovisionaries.ws.client.WebSocketThread.run(WebSocketThread.java:45)

Possible considerations...

  • Jackson API ObjectMapper failed to map the objects.
  • Henrik API provided a nulled images field.

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.