Coder Social home page Coder Social logo

namelessmc / nameless-link Goto Github PK

View Code? Open in Web Editor NEW
26.0 26.0 18.0 1.13 MB

The Nameless Link bot synchronizes ranks between a Discord Guild and a NamelessMC website.

Home Page: https://namelessmc.com/discord-bot-invite

License: MIT License

Java 99.83% Dockerfile 0.17%
discord jda namelessmc

nameless-link's People

Contributors

aaei924 avatar atoska21 avatar compacoderc avatar deadslost avatar dependabot-preview[bot] avatar dependabot[bot] avatar derkades avatar dominikslk avatar favorit5503 avatar historycagan1 avatar intersecato avatar itslynix avatar kaspiandev avatar loyoujoli avatar maiu15 avatar mansffer avatar marcos03br avatar padowyt2 avatar rageoffire avatar rgfdsohj0 avatar supercrafter100 avatar superkali avatar tadhgboyle avatar taucher2003 avatar viasnake avatar vicefusebox avatar weblate avatar xgigabaitx avatar zan1456 avatar zjerino 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

nameless-link's Issues

Request: Add forum post support to the API

Hello. I was trying to make a discord bot that would pull announcements from my forums category. I made a manual embed but when I tried to make it automatic I was told there was no support.
I was wondering if you could add these abilities to your API

  1. Get forum posts from a category
  2. Get title
  3. Get the forum post link
  4. Get forum post text
  5. Get forum post image embeds
    I have made an example of an embed for a discord bot
    https://cdn.discordapp.com/attachments/247865182477484032/891127359342776330/unknown.png
    image
    I hope you take this into consideration. This would be really cool if you could add it

more stats

  • uptime duration / datetime of startup
  • number of working and broken pings last startup

Add an option to set the rich presence of bot

An option could be added to set the bot's rich presence in the env settings, such as PLAYNG, STREAMING, etc. Etc.
And of course you can set what the bot is doing like playng on x server

Instructions unclear, ceiling fan

In reference to https://github.com/NamelessMC/Nameless-Link/wiki/Setup

Using NamelessHosting, I set up the panel integration a few weeks ago and that continues to work fine.

I've come back today to link NamelessMC and Discord accounts, but the bot is not accepting DMs. I am the guild owner, but am not particularly skilled at this. Tried kicking the bot and re-inviting it, but that made no difference. What am I doing wrong?

convo

!ping command

Unlike normal ping commands. This checks the connection to the API Server and the Plugin (if active)

Configurable option to update Discord nicknames with Minecraft name

This could be achieved by either letting the plugin making a POST request directly to Nameless-Link webserver, or go through hoops to the website first before sending it to Nameless-Link (with group sync/integration on)

It should be updated on join events or through a force update command. Though I'm not technical enough to know how it would perform.

[Suggestion] - Admin Commands (!VerifyRoles, !VerifyUsernames, !Ping)

Very simple commands that only someone with a linked admin role can use (maybe a website permission or website owner only or even discord permission set)

!VerifyRoles - Verifies all the roles in the discord and syncs them with the website (Pulls from the website to update) {Maybe even update plugin roles with website.}

!VerifyUsernames - Similar to !UpdateUsername (I beleive) in that it updates all users in the discord to ensure their names are the same as their Minecraft Account Usernames.

!Ping - Unlike normal ping commands. This checks the connection to the API Server and the Plugin (if active)

Question about Group Sync

I've set up Group Sync according to the wiki. Role ID is set up and the StaffCP shows integration is enabled and the bot successfully linked, but this happens:

  1. User123 joins our Discord for first time and has @everyone role.
  2. User123 signs up on NamelessHosting site and gets "Member" post-validation group.
  3. User123 returns to Discord and !verify is successful, but is not promoted to Member role.

Am I mistaken that User123 should be promoted to Member after verification (wiki says "roles are synced in both directions")? Or am I having to wait for #102 ? API rules:

rules

[Request] Deleting wiki

Deleting wiki and using wiki.js

Note: only making this possible when v2 pre13 releases and the pull request is merged

Bot ignores subdomain

NamelessMC 2.0.0-pr9 installed on subdomain, i.e. nameless.example.org

!apiurl 801111111111111111 https://nameless.example.org/index.php?route=/api/v2/or6bUquKxjAAAAtkDIdWl2VXCsJgAAAA

DM'ing the command above to the Nameless-Link bot returns the following error:

java.io.FileNotFoundException: https://example.org/index.php?route=/api/v2/or6bUquKxjAAAAtkDIdWl2VXCsJgAAAA/info

So it appears the subdomain nameless. is being ignored and I can't hook to the API. Thoughts?

Error while sending settings to websites at startup

Exception in thread "pool-3-thread-20" java.lang.NullPointerException: Cannot invoke "java.io.InputStream.read(byte[])" because "is" is null
  at com.namelessmc.java_api.RequestHandler.getBytesFromInputStream(RequestHandler.java:183)
  at com.namelessmc.java_api.RequestHandler.makeConnection(RequestHandler.java:135)
  at com.namelessmc.java_api.RequestHandler.post(RequestHandler.java:52)
  at com.namelessmc.java_api.NamelessAPI.setDiscordBotUrl(NamelessAPI.java:412)
  at com.namelessmc.bot.Main.lambda$main$0(Main.java:246)
  at com.namelessmc.bot.Main$$Lambda$266/0x00000000c62851b8.run(Unknown Source)
  at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  at java.base/java.lang.Thread.run(Unknown Source)

setUsernameSyncEnabled

"/configure username_sync state:true" threw this error

[pool-1-thread-1] INFO com.namelessmc.bot.commands.ConfigureCommand - Subcommand: username_sync
[pool-1-thread-1] ERROR com.namelessmc.bot.commands.ConfigureCommand - storage backend
com.namelessmc.bot.connections.BackendStorageException: java.lang.UnsupportedOperationException
at com.namelessmc.bot.connections.StatelessConnectionManager.setUsernameSyncEnabled(StatelessConnectionManager.java:77)
at com.namelessmc.bot.commands.ConfigureCommand.changeUsernameSync(ConfigureCommand.java:248)
at com.namelessmc.bot.commands.ConfigureCommand.lambda$execute$0(ConfigureCommand.java:75)
at com.namelessmc.bot.Main.lambda$canModifySettings$2(Main.java:280)
at net.dv8tion.jda.internal.requests.DeferredRestAction.queue(DeferredRestAction.java:148)
at com.namelessmc.bot.Main.canModifySettings(Main.java:278)
at com.namelessmc.bot.commands.ConfigureCommand.execute(ConfigureCommand.java:62)
at com.namelessmc.bot.listeners.CommandListener.lambda$onSlashCommandInteraction$0(CommandListener.java:55)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.UnsupportedOperationException
... 14 more
[pool-1-thread-1] INFO com.namelessmc.bot.commands.ConfigureCommand - username_sync

Can't find an invite link

I am on the latest dev build with the discord integration support. But I cannot find an invite link for the Nameless Link discord bot. Where/when is it?

Storage Backend Error /configure

I run start.sh and all is connected but after use /configure, show this:

Dec 02, 2023 4:48:30 PM org.glassfish.grizzly.http.server.HttpServer start
INFO: [HttpServer] Started.
[main] INFO com.namelessmc.bot.Main - Sending bot settings to https://xxx.net/index.php?route=/api/v2/
[main] INFO com.namelessmc.bot.Main - Sent bot settings to website and registered commands successfully.
[pool-1-thread-2] INFO Group sync discord->website - Sending roles for guild xxx to website
[JDA [0 / 1] MainWS-ReadThread] INFO com.namelessmc.bot.listeners.CommandListener - User xxx ran command /configure in guild xxxx
[pool-1-thread-4] INFO com.namelessmc.bot.commands.ConfigureCommand - Subcommand: link
[pool-1-thread-4] INFO com.namelessmc.bot.commands.ConfigureCommand - Checking if API URL works...
[pool-1-thread-4] INFO com.namelessmc.bot.commands.ConfigureCommand - Making request to info endpoint
[pool-1-thread-4] INFO com.namelessmc.bot.commands.ConfigureCommand - Website connection is working
[pool-1-thread-4] INFO com.namelessmc.bot.commands.ConfigureCommand - API URL seems to work. Sending bot settings...
[pool-1-thread-4] ERROR com.namelessmc.bot.commands.ConfigureCommand - storage backend
com.namelessmc.bot.connections.BackendStorageException: java.lang.UnsupportedOperationException
at com.namelessmc.bot.connections.StatelessConnectionManager.updateConnection(StatelessConnectionManager.java:54)
at com.namelessmc.bot.commands.ConfigureCommand.link(ConfigureCommand.java:147)
at com.namelessmc.bot.commands.ConfigureCommand.lambda$execute$0(ConfigureCommand.java:72)
at com.namelessmc.bot.Main.lambda$canModifySettings$2(Main.java:280)
at net.dv8tion.jda.internal.requests.DeferredRestAction.queue(DeferredRestAction.java:148)
at com.namelessmc.bot.Main.canModifySettings(Main.java:278)
at com.namelessmc.bot.commands.ConfigureCommand.execute(ConfigureCommand.java:62)
at com.namelessmc.bot.listeners.CommandListener.lambda$onSlashCommandInteraction$0(CommandListener.java:55)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.UnsupportedOperationException
... 14 more
[pool-1-thread-4] INFO com.namelessmc.bot.commands.ConfigureCommand - link

Use the ShardManager

It is recommended to use one shard for about 450 guilds. As the bot is currently on 441 guilds, this limit is not far away. For now it would be enough to update from a single JDA instance to an instance of the ShardManager and set the amount of shards to 1. But if the size of the bot grows, you will need to increase the amount of shards as needed.

Suggestion: like / dislike update for forums module

Like / dislike synchronization between discord and the website

So my suggestion is for the forms module. If you have a forum for suggestions, you can send the posts to the discord with a webhook. My idea is to make the bot actually do this.

What it could look like

image

As seen in this image, the footer contains the user that sent the suggestion but also the amount of likes / dislikes it has. The bot would send this message and the message ID would be stored in the database. The ID is linked to the suggestion so if it gets liked, the bot can find what message linked to that suggestion.

What should it do

When a suggestion gets a like / dislike, the website would send an event to the bot, which is in the guild and has the message id of the suggestion saved. The bot then requests the database looking for the message ID that is assigned to that suggestion. It then finds that message with the message ID in the guild and edits it. The like and dislike counter gets modified so the users in the discord know the amount of likes / dislikes a suggestion has.

Why would you need this?

This would mean you can remove bots that auto react with πŸ‘ and πŸ‘Ž and make the users just vote on the website. This means staff of the server can just sort the suggestions by vote count and get the top voted suggestions.

It also makes it so people in the discord itself can see the amount of votes and dont have to go to the website themselves to see it.

Bot DoesnΒ΄t work

I tryed installing the Bot via docker how it is writen in the Wiki. But everytime is start the docker-compose.yaml file it just gives me this error :
Starting root_link_1 ... error

ERROR: for root_link_1 Cannot start service link: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused "rootfs_linux.go:58: mounting \"proc\" to rootfs \"/var/lib/docker/overlay2/7abf34f08f0e960f9ff48e989d8ccf8cb3599a5dd1ea0fc3375aa3d69cebdbfb/merged\" at \"/proc\" caused \"permission denied\""": unknown

ERROR: for link Cannot start service link: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused "rootfs_linux.go:58: mounting \"proc\" to rootfs \"/var/lib/docker/overlay2/7abf34f08f0e960f9ff48e989d8ccf8cb3599a5dd1ea0fc3375aa3d69cebdbfb/merged\" at \"/proc\" caused \"permission denied\""": unknown
ERROR: Encountered errors while bringing up the project.

I have also tryed using the Manual version and it just gives me this error :
SEVERE: Guild with id 627786291618250752 does not exist. Is the ID wrong or is the bot not in this guild?

Yes, the Bot is in this Guild. Yes, the bot token is correct.
I am trying to do this on Linux / Ubuntu

Error when running !ping command

java.lang.IllegalStateException: Preventing use of complete() in callback threads! This operation can be a deadlock cause
  at net.dv8tion.jda.internal.requests.RestActionImpl.complete(RestActionImpl.java:216)
  at net.dv8tion.jda.internal.requests.DeferredRestAction.complete(DeferredRestAction.java:172)
  at net.dv8tion.jda.api.requests.RestAction.complete(RestAction.java:623)
  at com.namelessmc.bot.Main.canModifySettings(Main.java:244)
  at com.namelessmc.bot.commands.PingCommand.execute(PingCommand.java:48)
  at com.namelessmc.bot.commands.Command.lambda$execute$0(Command.java:79)
  at com.namelessmc.bot.commands.Command$$Lambda$283/0x00000000d80a77e8.accept(Unknown Source)
  at net.dv8tion.jda.api.requests.Request.lambda$onSuccess$0(Request.java:95)
  at net.dv8tion.jda.api.requests.Request$$Lambda$194/0x00000000043c6a48.run(Unknown Source)
  at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1429)
  at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
  at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1016)
  at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1665)
  at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1598)
  at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

/verify only works as command suggestion

When a user copy/pastes the (ex:)/verify 01234.5678 slash command from their user connections page and pastes it in a channel where the bot has permissions, the command does not run and there is no reply. To get it to work, a user must start to type /verify, select the command from the matching suggestions popup, and then paste the token argument in its field. This adds even more steps to those which already need to be explained to users. Haven't tested if this happens when DM'ing the bot, but we generally prefer to use a verification channel.

Option to prioritize sync source?

We have observed the following scenario for over a year now:

  1. New user joins our Discord (has no role), then
  2. user creates new website account, verifies email (has post-validation Member group), then
  3. when user links Discord, their [lack of] role appears to take priority (website gets downgraded to Unconfirmed Member group)

It seems most users have an opposite workflow, whereas they want Discord to be the deciding source. Still, we'd like to suggest a checkmark in the Group Sync page of Nameless which lets us choose which source should take priority.

Bot not working

I got the discord bot installed and got api enabled on namelessMC but when I try to do the !apiurl command with the bot I get the following error.

com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 22 path $
Unable to parse json. Received response code 200. Website response:
-----------------
<html><body><script type="text/javascript" src="/aes.js" ></script><script>function toNumbers(d){var e=[];d.replace(/(..)/g,function(d){e.push(parseInt(d,16))});return e}function toHex(){for(var d=[],d=1==arguments.length&&arguments[0].constructor==Array?arguments[0]:arguments,e="",f=0;f<d.length;f++)e+=(16>d[f]?"0":"")+d[f].toString(16);return e.toLowerCase()}var a=toNumbers("f655ba9d09a112d4968c63579db590b4"),b=toNumbers("98344c2eee86c3994890592585b49f80"),c=toNumbers("1aac22b4c4689f3fbf9c263037840ded");document.cookie="__test="+toHex(slowAES.decrypt(c,2,a,b))+"; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/"; location.href="http://reimagine.rf.gd/index.php?route=/api/v2/BbLUC1WnGdeRI4fTp8Am3HKw5kMjOqu6/info&i=1";</script><noscript>This site requires Javascript to work, please enable Javascript in your browser or use a browser with Javascript support</noscript></body></html>
-----------------

any suggestions???

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.