Skip to content

Commit

Permalink
Merge pull request #11 from marcmascarell/dev
Browse files Browse the repository at this point in the history
Fix destroyable servers query
  • Loading branch information
marcmascarell authored May 19, 2018
2 parents cb84841 + 726f66d commit d1e7d23
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/Models/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ export default class Server extends Model {
.query()
.where('id', match.server.id)
.update({
destroyed_at: moment().format('YYYY-MM-DD HH:mm:ss')
destroyed_at: moment().format('YYYY-MM-DD HH:mm:ss'),
status: 'destroyed'
})
})
.catch((e : Error) => {
Expand Down
2 changes: 1 addition & 1 deletion src/Seeds/matches.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ exports.seed = function(knex, Promise) {
last_activity_at: moment().format('YYYY-MM-DD HH:mm:ss'),
guild_id: '439806672911859713',
channel_id: '439806672911859717',
maps: 'carentan,harbor'
maps: 'germantown,carentan,harbor'
},
{
id: 2,
Expand Down
8 changes: 6 additions & 2 deletions src/Types/MapArgumentType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,20 @@ export default class MapArgumentType extends ArgumentType {

static get maps() : Array<string> {
return [
// Active map pool 7 maps (7/11)
'Carentan',
'Dawnville',
'Harbor',
'Neuville',
'Railyard',
'Depot',
'GermanTown',

// 'Container',
// 'Priory',
// 'Brecourt',
// 'Depot',
// 'Tigertown',
//

// 'Pavlov',
// 'POW Camp',
// 'Stalingrad',
Expand Down
9 changes: 6 additions & 3 deletions src/secrets.example.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
export default {
const secrets = {
passwordSalt: '',
rconSalt: '',
discordOwner: '',
discordToken: '',
digitalOceanToken: '',
jsonStore: '',

discordAdmins: [],
discordModerators: [],

Expand All @@ -14,5 +13,9 @@ export default {
development: [
'' // guild id
]
}
},

firebase: {}
}

export default secrets
4 changes: 2 additions & 2 deletions src/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const lookForDestroyableServers = () => {
.query()
.where('destroy_at', '<', moment().format('YYYY-MM-DD HH:mm:ss'))
.where('destroyed_at', null)
.where('ip', '!=', null)
.whereNotNull('ip')
.where('user_id', null) // user provided servers can't be destroyed
.then(servers => {
if (servers.length) {
Expand All @@ -34,7 +34,7 @@ const lookForDestroyableServers = () => {

const gameState = await Gamedig.query({
type: 'cod',
host: serverInfo[0], // Mugs server
host: serverInfo[0],
port: serverInfo[1]
})

Expand Down

0 comments on commit d1e7d23

Please sign in to comment.