Game Center invitation programmatically with GKInvite list - ios6

I am using Game Center in my game for iPhone in IOS 6. I have a tableview with a list of GameCenter´s friends. When I click a friend name, this friend recieve anotificatión (Game Center Notification) in her phone asking if he want to play the game against me. I am using my custom view all the time.
I am wondering how the other user can accept or reject the invitation to play the game. Can I have a uialertview telling YES or NOT, and if the user say yes create a new game with this two player using the following code?
GKMatchRequest *request = [[GKMatchRequest alloc] init];
request.minPlayers = 2;
request.maxPlayers = 2;
request.playersToInvite = [NSArray arrayWithObject:playerC_id];
[[GKMatchmaker sharedMatchmaker] addPlayersToMatch:myMatch matchRequest:request completionHandler:nil];
I don´t know if this is possible. I would prefer another solution, having a list of all the GKInvite that a user received for their friends. And with this list the user should be able to accept or delete invitation. If the user accept the invitation the game will start.
How other apps manage game center invitation to play? How they accept or reject?When does the game start, when the player send an invitation to play or when the other player accept invitation? When is consider that a GKInvite is accepted?How can I get the list of GKInvite that I have?
Any solution to this issue? How to manage Game Center invitations?

Related

Discord, sending a message to a different category and channel depending upon which reaction is selected

I have been working on a way within my discord server to try to automate the flow of users who want to try out for a team using bots. Currently I have adopted YAGPDB and have a role menu created in a community level (category) #general_tryouts channel with reactions to specify which game they want to pursue. When they select a reaction they are assigned a temporary role (24 hours) which will grant them access to the game specific category #tryouts channel they've selected. I've been successful with getting all of the roles assigned using YAG's gui interface. However, I would also like for a message to be sent to the game specific #tryouts channel with an embed (similar to a welcome message) stating that they would like to tryout, to notify the 'team' that they are "in the queue". So the process would look something like this:
User A pops into (Some Community) #general-tryouts -> reads the menu asking them which team they want to tryout for and selects option 1 (':one:') -> User A is given the role for TempGame1 and can now see (Some Game) #tryouts AND simultaneously a message is sent to (Some Game) #tryouts on their behalf.
If they choose option 2 they will receive a TempGame2 role and a message should be sent to (Another Game) #tryouts.
If they choose option 3 they will receive a TempGame3 role and a message should be sent to (ThisOther Game) #tryouts.
YAGPDB has the option with it's custom commands to fire a command triggered by a reaction given in a certain channel by someone with a certain role. The issue is getting the result of which reaction they selected, and that dictating where the message is sent. I'm really not even concerned if it's just a generic message. I just want User A to be able to react at a 'community' level and a message to get passed in to (Some Game) #tryout, (Another Game) #tryouts, or (ThisOther Game) #tryouts based on their selection.
My apologies in advance. I am only proficient enough to code a simple I say "ping" you output "pong" sort of transaction, and got in a little over my head in short order. I have looked at the developer resources trying to piece something together to no avail, as well as pulling a similar snippet of code from here and attempting to modify it to suit my needs, also to no avail. Any help would be greatly appreciated.
Code Sample
if (reaction.message.id === '730000158745559122') {
let channel = reaction.message.guild.channels.cache.get(targetChannelId);
console.log(reaction.emoji)
if (channel) {
let embed = new Discord.MessageEmbed();
embed.setAuthor(
user.tag,
user.displayAvatarURL({
dynamic: true,
format: 'png',
}),
);
embed.setDescription(`${user} has react a: ${reaction.emoji}`);
channel.send(embed);
}
}
Visual Representation
New
in the code if (reaction.message.id === '730000158745559122') the 73000 portion represents that whole message as a focal point on what the bot is 'listening' for. Any reaction to it, be it 1, 2, or 3 will trigger this singular process. So by what you are saying by using the (id === 123 || id === 456 || id === 789) {} would likely be the way to go if I had more than one message is was 'collecting' on for a lack of better way to state it. I believe what I need to do is
`if (reaction(':one:').message.id === 123 {send message ('nifty embed')to channel.id 12345}
if (reaction(':two:').message.id === 123 {send message ('nifty embed') to channel.id 67890}
if (reaction(':three:').message.id === 123 {send message ('nifty embed') to channel.id 16273}`

How to disable camera in amazon chime sdk meeting

I'm creating a meeting using amazon chime sdk library (in reactjs), where I don't want the option to open the camera at all. When the meeting is created, I'm setting the video input to null:
meetingManager.meetingSession.audioVideo.chooseVideoInputDevice(null)
What is happening is that the browser is asking for permissions to use the camera, turn it on for a second, and then turn it off (when the chooseVideoInputDevice() is being called).
What I want is to never ask for the camera permission, is that possible?
You can try join meeting with DeviceLabels.None to achieve your goal.
import {
DeviceLabels,
useMeetingManager,
} from 'amazon-chime-sdk-component-library-react';
const meetingManager = useMeetingManager();
await meetingManager.join({
meetingInfo,
attendeeInfo,
deviceLabels: DeviceLabels.None, // here
});

Errors with multi turn dialog in alexa skills

I have created a skill with name "BuyDog" and its invocation name is "dog app"
So that should mean, I can use the intents defined inside only after the invocation name is heard. (is that correct?)
Then I have defined the Intents with slots as:
"what is {dog} price."
"Tell me the price of {dog}."
where the slot {dog} is of slot type "DogType". I have marked this slot as required to fulfill
Then I have added the endpoint to AWS lambda function where I have used the blueprint code of factskills project in node.js, and done few minor changes just to see the working.
const GET_DOG_PRICE_MESSAGE = "Here's your pricing: ";
const data = [
'You need to pay $2000.',
'You need to pay Rs2000.',
'You need to pay $5000.',
'You need to pay INR 3000.',
];
const handlers = {
//some handlers.......................
'DogIntent': function () {
const factArr = data;
const factIndex = Math.floor(Math.random() * factArr.length);
const randomFact = factArr[factIndex];
const speechOutput = GET_DOG_PRICE_MESSAGE + randomFact;
}
//some handlers.......................
};
As per the about code I was expecting when
I say: "Alexa open dog app"
It should just be ready to listen to the intent "what is {dog} price." and the other one. Instead it says a random string from the node.js code's data[] array. I was expecting this response after the Intent was spoken as the slot was required for intent to complete.
And when
I say: "open the dog app and Tell me the price of XXXX."
It asks for "which breed" (that is my defined question) But it just works fine and show the pricing
Alexa says: "Here's your pricing: You need to pay $5000."
(or other value from the data array) for any XXXX (i.e. dog or not dog type).
Why is alexa not confirming the word is in slot set or not?
And when
I say: "open the dog bark".
I expected alexa to not understand the question but it gave me a fact about barking. WHY? How did that happen?
Does alexa have a default set of skills? like search google/amazon etc...
I am so confused. Please help me understand what is going on?
Without having your full code to see exactly what is happening and provide code answers, I hope just an explanation for your problems/questions will point you in the right direction.
1. Launching Skill
I say: "Alexa open dog app"
It should just be ready to listen to the intent...
You are expecting Alexa to just listen, but actually, Alexa opens your skill and is expecting you to have a generic welcome response at this point. Alexa will send a Launch Request to your Lambda. This is different from an IntentRequest and so you can determine this by checking request.type. Usually found with:
this.event.request.type === 'LaunchRequest'
I suggest you add some logging to your Lambda, and use CloudWatch to see the incoming request from Alexa:
console.log("ALEXA REQUEST= " + event)
2. Slot Value Recognition
I say: "open the dog app and Tell me the price of XXXX."
Why is alexa not confirming the word is in slot set or not?
Alexa does not limit a slot to the slot values set in the slotType. The values you give the slotType are used as a guide, but other values are also accepted.
It is up to you, in your Lambda Function, to validate those slot values to make sure they are set to a value you accept. There are many ways to do this, so just start by detecting what the slot has been filled with. Usually found with:
this.event.request.intent.slots.{slotName}.value;
If you choose to set up synonyms in the slotType, then Alexa will also provide her recommended slot value resolutions. For example you could inlcude "Rotty" as a synonym for "Rottweiler", and Alexa will fill the slot with "Rotty" but also suggest you to resolve that to "Rottweiler".
var resolutionsArray = this.event.request.intent.slots.{slotName}.resolutions.resolutionsPerAuthority;
Again, use console.log and CloudWatch to view the slot values that Alexa accepts and fills.
3. Purposefully Fail to Launch Skill
I say: "open the dog bark".
I expected alexa to not understand the question but it gave me a fact about barking.
You must be doing this outside of your Skill, where Alexa will take any inputs and try to recognize an enabled skill, or handle with her best guess of default abilities.
Alexa does have default built-in abilities (not skills really) to answer general questions, and just be fun and friendly. You can see what she can do on her own here: Alexa - Things To Try
So my guess is, Alexa figured you were asking something about dog barks, and so provided an answer. You can try to ask her "What is a dog bark" and see if she responds with the exact same as "open the dog bark", just to confirm these suspicions.
To really understand developing an Alexa skill you should spend the time to get very familiar with this documentation:
Alexa Request and Response JSON Formats
You didn't post a lot of your code so it's hard to tell exactly what you meant but usually to handle incomplete events you can have an incomplete even handler like this:
const IncompleteDogsIntentHandler = {
// Occurs when the required slots are not filled
canHandle(handlerInput) {
return handlerInput.requestEnvelope.request.type === 'IntentRequest'
&& handlerInput.requestEnvelope.request.intent.name === 'DogIntent'
&& handlerInput.requestEnvelope.request.dialogState !== 'COMPLETED'
},
async handle(handlerInput) {
return handlerInput.responseBuilder
.addDelegateDirective(handlerInput.requestEnvelope.request.intent)
.getResponse();
}
you add this handler right above your actual handler usually in the index.js file of your lambda
This might not fix all your issues, but it will help you handle the event when a user doesn't mention a dog.

Resorting a struct by clientID in Golang

I have a database where an admin has multiple clients, and a notification database holding all of the notifications. In the struct, it is able to identify that the notifications belong to a particular user, and that these users belong to a particular administrator.
I have a database of notifications (Example: "User1 has accepted their account", "User1 has made a payment", "User2 has made a payment", "User3 has been invited", etc.) and I am trying to build a report page where the administrator are able to view their client's notifications. I'm having trouble figuring out how to make a dynamic map to reorganize the map so that notifications are assigned to each user.
Example:
User 1:
Lists user 1's notifications
User 2:
Lists user 2's notifications
Using Golang with mongodb, with a bootstrap/ go template front end. Here is what I have concept-wise:
var notes []Notifiation
//code to pull all notifications from the database
var report{}
//loop to reorganize notes into report{} by the clientID
for i=0 ; range notes; i++ {
report{i} = clientID(i)
}
//Create the map to pass to the template:
d := M{report{}}
respond(w, r, http...., d, nil)
I hope someone can understand my thought process. I'm still pretty new and I know I'm dealing with some advanced concepts.

PayPal SandBox PLATFORM error 589009

I am trying to get my IOS6 app to make payments to PayPal's sandbox but there seems to be some problem with the Beta release that I am using. I have included the PayPal-iOS-SDK-1.0.4 and have configured the environment to be PayPalEnvironmentSandbox and then I have added the credentials from my developer account as seen below:
if (payment.processable)
{
[PayPalPaymentViewController setEnvironment:self.environment];
NSString *customerId = [[[GlobalVariables sharedInstance] userAccount] objectForKey:#"email"];
PayPalPaymentViewController *paymentViewController = [[PayPalPaymentViewController alloc]
initWithClientId:kPayPalClientId
receiverEmail:kPayPalReceiverEmail
payerId:customerId
payment:payment
delegate:self];
paymentViewController.hideCreditCardButton = !self.acceptCreditCards;
[self presentViewController:paymentViewController animated:YES completion:nil];
}
The kPayPalClientId is the Client ID from the Rest API Credentials page and the kPayPalReceiverEmail is my PayPal account (which in this case is a Swedish account).
But when I run this against the Sandbox environment i just get PLATFORM error 589009.
But if I change the kPayPalReceiverEmail to a dummy one like: #"YOUR_PAYPAL_EMAIL#yourdomain.com" it works, but then the payment is no longer connected to my account (the amount seems to be drawn from my buyeraccount but no money ends up in my recieveraccount). So when I try to verify the payment it can't be done.
So what is the problem here you think?

Resources