Discord4j move user to another channel - java

I have users connected to the voice channel "waited" and I would like to move them to another channel. How to do it? Is it supported by discord4j?

Look at GuildMemberEditSpec. There is a command setNewVoiceChannel that can be used to move the user to a new voice channel.

Related

How to create a Text Channel in Discord Using JDA: Java Discord Api

event.getGuild().createTextChannel("EzDedline_Reminder")
I have used this command for creating a text channel however the Text channel does get created.
I have given the bot administrative powers and added an event listener in the main function and have extended the listener adapter as well.
I do have the power to manage the channel as I am the owner of server.
Moreover, the code after this line is executing perfectly just this line of code is not able to create a new text channel.
event is the command entered by the user to run this function.
I am using JDA 4.2.1
Call queue().
event.getGuild().createTextChannel("ezdedline_reminder").queue();
See Nothing happens when using X and What is a RestAction?.

Enable notification channels programmatically

I am able to check if the channel is enabled/disabled with
NotificationChannel channel = manager.getNotificationChannel(channelId);
boolean isEnabled = channel.getImportance() != IMPORTANCE_NONE;
But if the channel is not enabled then I would like to enable it by setting it to IMPORTANCE_HIGH
if (!isEnabled) {
channel.setImportance(NotificationManager.IMPORTANCE_HIGH);
manager.createNotificationChannel(channel);
}
The problem is that the channel is not updated, it only works if I tried to disable it with IMPORTANCE_NONE in case it is enabled, but not the way around.
I have tried to delete the channel and create a new one with a different id, that works, but not creating a new one with the same id.
How to get around this?
You can't change channel importance programmatically without deleting the channel.
Because user may have changed the importance manually.
To achieve this programmatically to get channel and create new channel with new id.
delete the old channel.
Your changes will not reflect if create channel with previous id
for reference check WhatsApp application try to change the ringtone from application and see in channel at bottom left x channel is deleted message

Twilio call a user, play audio and receive callback

I need some help in achieving functionality using twilio API.
I want to call user and play some pre-recorded audio file and receive callback status/event.
Here is what I have achieved.
Twilio.init(TWILIO_SID, TWILIO_AUTH_TOKEN);
Call call = Call.creator(new PhoneNumber(callDetailModel.getToNumber()),
new PhoneNumber(FROM_TWILIO_NUMBER),
new URI(API_URL + "/call/twilio/voice/demo-voice")).create();
Now in "/call/twilio/voice/demo-voice" I am generating TwiML.
Play play = new Play.Builder(
"demo-play.wav")
.loop(1).build();
Number number = new Number.Builder(request.getParameter("Caller"))
.statusCallback(API_URL + "/call/twilio/events-demo")
.statusCallbackMethod(Method.POST).statusCallbackEvents(Arrays
.asList(Event.INITIATED, Event.RINGING, Event.ANSWERED, Event.COMPLETED)).build();
Dial dial = new Dial.Builder()
.timeLimit(60)
.callerId(request.getParameter("Called"))
.record(Dial.Record.DO_NOT_RECORD)
.number(number).build();
VoiceResponse twiml = new VoiceResponse.Builder().dial(dial).play(play).build();
return (twiml.toXml());
And now in event callback we are checking if receiver has received call or not, is it completed or not etc.
Now, the problem is when user receive a call auto voice mail of Twilio is getting played and after that my demo-play.wav get played. We want to remove that twilio voice mail and want to play only demo-play.wav which we have passed through TwiML.
UPDATE:
The audio getting played is here.
https://vocaroo.com/i/s0KNEhHxUKX5
Also the twiml which is generated is something like this
<Response>
<Dial timeLimit="7200" callerId="+1xxxxx" record="record-from-answer-dual">
<Number statusCallbackEvent="initiated ringing answered completed" statusCallback="http://38c5cb01.ngrok.io/call/twilio/events-demo" statusCallbackMethod="POST">+1zzzzzzzz</Number>
</Dial>
<Play loop="1">https://aws.xxx.H1OAOec30bbc5-bc3a-4251-a27c-2e4e41b386061521208641292FOIZ1.wav</Play>
</Response>
Am I missing something? Do I need to pass the Play in Dial verb? If then how?

check automatically for new message android

I am trying to create a simple android messaging app. So basically let us assume that user A sends a message to user B. I would like that user B receives a notification when the message is received. I know how to create the notification and all. But basically I would like to know how the user B constantly checks if a new message has been received even when he is out of the app, and then that would trigger the notification and subsequent actions.
Thank you
You have to setup an unbound background service.
With this you can constantly make pull-requests to your server or get push-notifications from your server and display notifications.
https://developer.android.com/training/run-background-service/create-service.html
You can use Event Bus lib for this purpose. When new message will be received it will create and event and then you can receive that event event and do other operations.
If you are talking about text messages then you will have to create a BroadcastReceiver
http://developer.android.com/reference/android/content/BroadcastReceiver.html
You can see my answer here for SMS Receiver
Verify sms text message by app before it displayed to user
Don't forget to give permissions in your app's manifest.
Hope it helps.

GStreamer dynamically change the filesrc location of a pipeline- No sound

I am currently on working on my university project which involves GStreamer audio streaming.
I have successfully managed to get streaming working between client/server and TCP.
My next task is to dynamically change the audio stream on user input.
I tried the following:
pp.setState(State.PAUSED);
pp.setState(State.READY);
pp.unlink(src);
source = ElementFactory.make("filesrc", "src");
pp.link(source);
source.set("location", fpath);
pp.setState(State.PLAYING);
fpath is the audio file location. When a user input is received, the state is set to PAUSE, the source is unlinked and a new source is added. The state is set to PLAYING.
I used GST_DEBUG on client side and there are no errors, buffers are sent to the client but no sound.
Any suggestions would be appreciated.
You don't need to unlink and add a new source. Just go straight to READY (no need to go to PAUSED and then to READY, this will happen implicitly), set a new location and go back to playing.
you need to syncStateWithParent();.
I am using it for different purpose but this can be extended to your application on property change Gstreamer: Pausing/resuming video in RTP streams

Categories

Resources