move ids to config
This commit is contained in:
parent
2fd27fc5f1
commit
5645fb9f79
|
@ -1,3 +1,4 @@
|
|||
/local/
|
||||
node_modules/
|
||||
.DS_Store
|
||||
test.sh
|
||||
|
|
|
@ -7,7 +7,6 @@ global.colorRoles = { // TODO clean up this, adsfhaiusdhgaisuhg
|
|||
name:"[]",
|
||||
permissions:[],
|
||||
color:"RANDOM",
|
||||
//position: member.guild.roles.get('346754988023873546').position
|
||||
}});
|
||||
return role;
|
||||
},
|
||||
|
|
|
@ -42,7 +42,7 @@ global.commands = {
|
|||
//var name = msg.txt(1).replace(/[^a-zA-Z0-9]/g, '-').substr(0,100).toLowerCase();
|
||||
var name = msg.txt(1);
|
||||
msg.guild.channels.create(name, {
|
||||
parent: '399735134061985792',
|
||||
parent: config.channels.user_channels,
|
||||
overwrites: [
|
||||
{
|
||||
id: msg,
|
||||
|
@ -79,7 +79,7 @@ global.commands = {
|
|||
var channel = msg.channel;
|
||||
}
|
||||
if (!channel.permissionsFor(msg.member).has('MANAGE_CHANNELS')) return msg.react('🚫');
|
||||
await channel.setParent('425054198699261953');
|
||||
await channel.setParent(config.channels.deleted_channels);
|
||||
await channel.lockPermissions();
|
||||
msg.react('🆗');
|
||||
}
|
||||
|
|
|
@ -1,18 +1,32 @@
|
|||
module.exports = {
|
||||
|
||||
"testmode": new Boolean(process.env.TEST),
|
||||
|
||||
"DISCORD_TOKEN": process.env.DISCORD_TOKEN,
|
||||
"DATABASE_URL": this.testmode ? "postgres://localhost/k4t" : process.env.DATABASE_URL,
|
||||
"MONGODB_URI": this.testmode ? "mongodb://localhost/k4t" : process.env.MONGODB_URI,
|
||||
|
||||
"token": process.env.DISCORD_TOKEN,
|
||||
|
||||
"webhooks": {
|
||||
"console": process.env.WEBHOOK_CONSOLE.split("/"),
|
||||
"welcome": process.env.WEBHOOK_WELCOME.split("/"),
|
||||
},
|
||||
|
||||
"opID": "281134216115257344",
|
||||
"guildID": this.testmode ? "" : "321819041348190249",
|
||||
"channels": {
|
||||
"main": this.testmode ? "" : "321819041348190249"
|
||||
"guildID": this.testmode ? "467473467634089985" : "321819041348190249",
|
||||
|
||||
"channels": { // includes voice channels & category channels
|
||||
"main": this.testmode ? "467473467634089987" : "321819041348190249",
|
||||
"voice": this.testmode ? "467473467634089989" : "425060452129701889",
|
||||
"name_collection": this.testmode ? "" : '379738469511069698',
|
||||
"mpp_bridges": this.testmode ? "" : '360557444952227851',
|
||||
"user_channels": this.testmode ? "" : '399735134061985792',
|
||||
"deleted_channels": this.testmode ? "" : '425054198699261953',
|
||||
"deleted_bridges": this.testmode ? "" : '451838300068511745',
|
||||
"mpp_screenshot": this.testmode ? "" : '383773548810076163',
|
||||
"owop_screenshot": this.testmode ? "" : '399079481161023492'
|
||||
},
|
||||
|
||||
"roles": {
|
||||
"viewing_deleted_channels": this.testmode ? "467473718353068042" : "425060792455397376",
|
||||
},
|
||||
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@ process.on('uncaughtException', error => {
|
|||
});
|
||||
|
||||
|
||||
(require('mongodb').MongoClient).connect(process.env.MONGODB_URI).then(client=>{
|
||||
(require('mongodb').MongoClient).connect(config.MONGODB_URI).then(client=>{
|
||||
global.mdbClient = client;
|
||||
dClient.login(config.token);
|
||||
dClient.login(config.DISCORD_TOKEN);
|
||||
});
|
||||
|
||||
dClient.once('ready', () => {
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
// view deleted channels
|
||||
(async function(){
|
||||
var vcid = '425060452129701889';
|
||||
var rid = '425060792455397376';
|
||||
var vcid = config.channels.voice;
|
||||
var rid = config.roles.viewing_deleted_channels;
|
||||
dClient.on('voiceStateUpdate', async (oldMember, newMember) => {
|
||||
if (oldMember.voiceChannelID != vcid && newMember.voiceChannelID == vcid) {
|
||||
// member joined the channel
|
||||
|
|
|
@ -15,7 +15,7 @@ module.exports = {
|
|||
} else /* rebridge */ {
|
||||
let channel = dClient.guilds.get(config.guildID).channels.get(existingBridge.discord_channel_id);
|
||||
await dbClient.query("UPDATE bridges SET disabled = false WHERE mpp_room = $1", [room]);
|
||||
await channel.setParent('360557444952227851');
|
||||
await channel.setParent();
|
||||
await channel.lockPermissions();
|
||||
createMPPbridge(room, existingBridge.mpp_room, existingBridge.site, existingBridge.webhook_id, existingBridge.webhook_token);
|
||||
await msg.reply(`${site} room ${room} has been re-bridged.`);
|
||||
|
@ -25,7 +25,7 @@ module.exports = {
|
|||
}
|
||||
/* new bridge */
|
||||
var discordChannelName = room.replace(/[^a-zA-Z0-9]/g, '-').toLowerCase();
|
||||
var categoryID = '360557444952227851';
|
||||
var categoryID = config.channels.mpp_bridges;
|
||||
var channel = await dClient.guilds.get(config.guildID).channels.create(discordChannelName, {parent: categoryID});
|
||||
channel.setTopic(`http://www.multiplayerpiano.com/${encodeURIComponent(room)}`);
|
||||
var webhook = await channel.createWebhook('Webhook');
|
||||
|
|
|
@ -20,7 +20,7 @@ module.exports = {
|
|||
await dbClient.query("UPDATE bridges SET disabled = 'true' WHERE mpp_room = $1", [bridge.mpp_room]);
|
||||
clients.MPP[bridge.mpp_room].stop();
|
||||
var channel = dClient.channels.get(bridge.discord_channel_id)
|
||||
await channel.setParent('451838300068511745');
|
||||
await channel.setParent(config.channels.deleted_bridges);
|
||||
await channel.lockPermissions();
|
||||
msg.reply(`${bridge.mpp_room} has been unbridged.`);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ module.exports = {
|
|||
|
||||
var newMsg = function(continued){
|
||||
var str = `__**${participant._id}**__${continued ? ' (continued)' : ''}\n${participant.name}`;
|
||||
return dClient.channels.get('379738469511069698').send(str);
|
||||
return dClient.channels.get(config.channels.name_collection).send(str);
|
||||
}
|
||||
|
||||
var document = await this.collection.findOne({_id: participant._id});
|
||||
|
@ -17,7 +17,7 @@ module.exports = {
|
|||
document.names.push(participant.name);
|
||||
this.collection.updateOne({_id: participant._id}, {$set:{names: document.names}});
|
||||
|
||||
let message = await dClient.channels.get('379738469511069698').messages.fetch(document.discord_msg_id);
|
||||
let message = await dClient.channels.get(config.channels.name_collection).messages.fetch(document.discord_msg_id);
|
||||
try {
|
||||
await message.edit(message.content + ', ' + participant.name);
|
||||
} catch(e) {
|
||||
|
|
|
@ -11,14 +11,14 @@ global.screenshotter = {
|
|||
var screenshot = await page.screenshot({type: 'png'});
|
||||
var filename = `Screenshot of www.multiplayerpiano.com/lobby @ ${new Date().toISOString()}.png`;
|
||||
var attachment = new Discord.MessageAttachment(screenshot, filename);
|
||||
await dClient.channels.get('383773548810076163').send(attachment);
|
||||
await dClient.channels.get(config.channels.mpp_screenshot).send(attachment);
|
||||
await page.goto('http://ourworldofpixels.com');
|
||||
await page.evaluate(function(){OWOP.camera.zoom = 1;});
|
||||
await new Promise(resolve => setTimeout(resolve, 5000));
|
||||
var screenshot = await page.screenshot({type: 'png'});
|
||||
var filename = `Screenshot of ourworldofpixels.com/main @ ${new Date().toISOString()}.png`;
|
||||
var attachment = new Discord.MessageAttachment(screenshot, filename);
|
||||
await dClient.channels.get('399079481161023492').send(attachment);
|
||||
await dClient.channels.get(config.channels.owop_screenshot).send(attachment);
|
||||
await browser.close();
|
||||
console.log('Finished screen captures');
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue