The || function isnt working when checking for user id - visual-studio-code

if (message.content.startsWith('!'))
{
if(message.author.id !== ('490510038469705747') || message.author.id !==('752606131569950800)') || message.author.id !==('422003274045063179') || message.author.id !==('395291950690861057'))
return message.channel.send('!You aint my master! ._.');
}
this code doesnt work, and it always just says You aint my master to anyone thats running the command
please help
i am using discord.js with visual studio code

You should be using && instead of ||. When you're using ||, the if statement will pass even if only one of the parameters resolves to true. If you use &&, the if statement will only pass if ALL of the parameters resolve to true.
Additionally it seems you've got a stray parenthese in one of your strings message.author.id !==('752606131569950800)').

Related

IBM Watson Assistant: Expressions on dialog node condition using array?

For IBM Watson Assistant and a dialog node condition I want to check if the context variable long_name_context_var has one of the values 1,2,3,4,5. The normal way would be
$long_name_context_var == 1 || $long_name_context_var == 2 ||
$long_name_context_var == 3 || $long_name_context_var == 4 ||
$long_name_context_var == 5
But it is visually too long. Thus, I want to shorten it.
I tried to use JSONArray.contains and Array literals as
[1,2,3,4,5].contains($long_name_context_var)
but failed.
Doesn't the node condition support array literals? Or would it give a syntax error?
The conditions on a dialog node in IBM Watson Assistant support SpEL-based expressions. This includes the contains function on JSON arrays.
Have you enabled debugging in the Try it to see the value of the context variable? I assume your node works with the "visually too long" expression. Is the type of the context variable a string or a number? Try using
["1","2","3","4","5"].contains($long_name_context_var)
What definitely works is to assign the array to a context variable (in my test testme in the context editor in Try it) and then use the following expression:
$testme.contains("3")
Else you could try the indexOf function.
Try with:
$long_name_context_var >= 1 || $long_name_context_var <= 5

How to deal with Null for custom condition in Azure Pipeline?

I'm finding the best way to find a variable is null on the custom condition.
I tried to compare null. However, Azure Pipeline complains cause error, if I configure like this.
and(failed(), ne(variables['Some'], Null))
Also, This configuration doesn't throw an error, however, when the 'Some' is null, the condition becomes false. Since Null and 'Null' is different.
and(failed(), ne(variables['Some'], 'Null'))
I eventually come up with a workaround. However, it is not cool way. I add PowerShell task, and create this script.
if ($env:Some -eq $null) {
Write-Host "##vso[task.setvariable variable=SkipSome]True"
}
then configure custom condition
and(failed(), ne(variables['SkipSome'], 'True'))
I expect there is a way to compare with null without the powershell. However, I can't find it on the official documentation.
How to deal with Null for custom condition in Azure Pipeline?
To deal with Null for custom condition, we should use '' instead of Null or 'Null'.
You can check the String for some details.
So, you can configure it like following:
and(failed(), ne(variables['Some'], ''))
To test it more intuitively, I change the ne to eq:
and(failed(), eq(variables['Some'], ''))
Then I set the variable is empty on the Variable tab, and add a Inline powershell task with above condition:
In the log, we could see that task is executed:
Hope this helps.

ng-file-upload issue on IE9 - after uploading one file receiving error

var prevFiles = ((ngModel && ngModel.$modelValue) || attr.$$ngfPrevFiles || []).slice(0);
I am getting an error that the result of this statement does not have a slice method.
Without knowing too much about the module I have a theory:
The first evaluation (ngModel && ngModel.$modelValue), when true, returns a Boolean which does not have a slice method.
There was an issue filed in Github about this https://github.com/danialfarid/ng-file-upload/issues/1139
Reportedly fixed in release 10.0.3.

Reuse of conditions (when) in Drool DSL statements

Is it possible to reuse a when/condition statement into another when/condition statement in a DSL file?
For example, I have two conditions:
[condition][]The client is invalid = Client( name == null || email == null )
[condition][]All the clients are invalid = forall( Client( name == null || email == null ) )
Note that the second condition just diff the first for the forall command, but the statement inside is equals. In these case, I want to reuse the first condition into the second.
Is it possible? How?
Thank you.
even the most recent version of drools will only let you substitute values into a template from pojo's or a corresponding map as per their documentation here.
This won't work for your use case though.
Since drool files are simply text files, there is nothing preventing you from considering a more powerful templating toolkit.
Possibilities include Apache Velocity, ANTLR or Scala!

postgres coldfusion concatenation of string inside cfquery tag

<cfquery name="LOCAL.qrySelEvents" datasource="#variables.datasourceSettings.getDatasourceName()#" result="LOCAL.qryData" >
SELECT evt_id,
acnt_dba_name,
form_id,
'#application.portals.data[request.applicationName].profileRootPath#form/index.cfm'
|| CHAR(63)
|| 'PKformID= '
|| #preserveSingleQuotes(LOCAL.formIdSql)# AS primaryFormURL,
FROM events
</cfquery>
I have to concat #application.portals.data[request.applicationName].profileRootPath#form/index.cfm with char(32) and PKformID= ' || #preserveSingleQuotes(LOCAL.formIdSql)#. I have used the || operator of postgres. But it is giving me an error:
ERROR: syntax error at or near "||"
Can you please help me in this?
The last line of your select clause has a comma at the end.
OK, as well as the error message, if you have ROBUST EXCEPTION HANDLING switched on (it's in CFAdmin), you should get back the SQL that CF was passing to the server. This should show you where the syntax error is in your SQL. You should also always post this info in your question, so even if you can't see the problem, someone else might be able to.
Now I suspect it's because this:
#preserveSingleQuotes(LOCAL.formIdSql)#
needs to be treated as a string (which it is), in which case you'll need to quote it for the DB to see it as a string. IE:
'#preserveSingleQuotes(LOCAL.formIdSql)#'
Given there is no DB-centric references in that whole value:
`'#application.portals.data[request.applicationName].profileRootPath#form/index.cfm' || CHAR(63) || 'PKformID= ' || '#preserveSingleQuotes(LOCAL.formIdSql)#'`
I question why you need to include it in your SELECT query. You're basically just passing the value to the SQL server, and just getting it back again afterwards. So I suspect something is amiss here. What are you actually trying to do here?
Ya finally got the answer of this , CHAR(63) is creating problem in this as in Sql-server CHAR is a function which gives Character from ASCII and in postgresql CHR() function is available in order to give character from ASCII. So , new Query is :
<cfquery name="LOCAL.qrySelEvents" datasource="#variables.datasourceSettings.getDatasourceName()#" result="LOCAL.qryData" >
SELECT evt_id,
acnt_dba_name,
form_id,
'#application.portals.data[request.applicationName].profileRootPath#form/index.cfm'
|| CHR(63)
|| 'PKformID= '
|| #preserveSingleQuotes(LOCAL.formIdSql)# AS primaryFormURL
FROM events
</cfquery>
Thanks for all your support.