Java&JDA - Send message without any event [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
So, i have problem. I'm making script on Java with sending logs to my discord server. And i using JDA Api. That script should send message when it will be opened. So without any events. Anyone can help me?
Thanks
Some edit: Sorry for my bad english, ima from Russia btw

You have to first get the bot instance you are working with, then get the text channel. After you made sure the bot can talk there, you can send a message (or multiple).
It would look something like this:
TextChannel textChannel = YourBotInstance.getJda().getTextChannelById("386242731875368960");
if(textChannel.canTalk()) {
textChannel.sendMessage("Your message here.").queue();
}

Related

MINECRAFT: Is there a way of blocking messages incoming from a plugin? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I am pretty new to Java. I learned a lot this month by making Minecraft plugins and I'd like to try making a new type of plugin:
a plugin that blocks messages incoming from another plugin if them contain a certain word or sentence.
How can I achieve that? I'm asking this because there are lot of plugins with hardcoded messages and people who don't know how to code cannot change them. I am making some addon plugins for many other plugins to help people customizing messages. Any help would be highly appreciated.
Yes, that's possible. You should intercept the message you don't want using packet handling.
You can do it directly from the Bukkit server or on the Bungeecord proxy layer.
To make things easy, you can use ProtocolLib. I've not been working with Minecraft for a long time, I'm not sure how different will be that library but I let you here a piece of code to let you search on it.
ProtocolLibrary.getProtocolManager().addPacketListener(
new PacketAdapter(this, ConnectionSide.SERVER_SIDE, Packets.Server.CHAT) {
#Override
public void onPacketSending(PacketEvent event) {
String message = event.getPacket().getStrings().read(0);
event.getPacket().getStrings().write(0, "Intercepted: "+message);
}
}
);

How to run scheduled task in AWS? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I have a school application. Where the teacher can send mail to each parent. Parent has to check email and confirm (reply) back in 2 days .
If the parent does not respond back we automatically need to send out second followup email.
Parent response will be parsed in Lambda and same will be updated in database. so that we should not send followup email .
I am using Amazon SES for sending the email.
How can implement wait for 2 days logic ? should I use lambda function or JScheduler ?
How can implement wait for 2 days logic ?
You may use AWS Step functions which is statefull state-machine workflow. The service implements a wait task you may use to way for 2 days

How to automatically retweet a twitter page? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
How to automate the task of retweetsof a page: twitter.com/promotional/sample_page in such a way that whenever there is tweet posted on twitter from that page then the automated script retweeted from my twitter account twitter.com/demo-account/ .
Can it be implemented using python or java?
Following the attached link:
http://www.techcovered.org/how-to-create-your-own-twitter-auto-retweet-bot/
You can easily do this in python using TwitterAPI.
The steps are basically:
Authenticate
from TwitterAPI import TwitterAPI api = TwitterAPI(consumer_key,
consumer_secret, access_token_key, access_token_secret)
Grab the tweet you want to retweet
Tweet it
x = api.request('statuses/update', {'status': the tweets text})
print(x.status_code)
It is quite straight forward, I won't spoil it for you posting the full working code.

How to create socket to receive both text and image [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to create a server which receives both text and image. For text I used DataInputStream dis.readUTF(), and for image, I used ObjectInputStream ois.readObject() to read the image as byte[]. So how can I write code to detect the data receiving is text or byte[]?
You'll have to use some kind of signal from the client to know whether it is sending text or an image.
Alternatively, you could receive on different ports depending on the type of input.

How to avoid resending emails or missing emails in this case? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
dataContext.saveSend(true);
SendEmailsToAllMembers();
I have the code above, if after half of the emails were sent out, there is a error in smtp, then how can I avoid resending emails or missing emails in this cases ?
Inside the SendEmailsToAllMembers you could store which emails have been successfully sent to. Repeat calls to the method could check if this email has already been sent successfully and therefore not resend it.

Categories