'How can I do this query in Flask-SQLAlchemy?
is it possible and how this querie in a flask with SQLALchemy
SELECT * FROM records
WHERE status = 'SCHEDULE'
OR status = 'RECORDING'
OR status = 'FAILED'
AND fail_type='S3_CONNECTION'
I am using the following code:
Record().query.filter(
Record.id == record_id,
Record.status in (Status.SCHEDULED, Status.RECORDING)
Record.status == Status.FAILED
Record.fail_type == 'S3_CONNETION'
).one()
But this is all AND instead or or and
How can I do that querie?
Thanks
Solution 1:[1]
I think you're expecting a reply from the user in dm's
If that's the case you'll have to use a collector or awaitMessages
Your code is also in djs v12; I recommend you to update to djs v13 for support and more features
client.on("message", async message => {
if (message.content === "!whitelist") {
message.guild.members.cache.forEach((member) => {
if (member.roles.cache.has(staffID)) {
member.send(`Hey ! Congratulation you are whitelisted ! `).then(msg => {
const filter1 = m => m.author.id === message.author.id
msg.channel.awaitMessages({filter: filter1, time: 5 * 12000, max: 1}).then(messages =>{
let msg1 = messages.first().content
if(msg1 === "!speak"){
member.send('Hi how are you?')
}
})
})
}
})
}
})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Azer |
