pinano-discord / Pinano-Discord-Bot

A Discord bot for the Pinano guild
MIT License
9 stars 11 forks source link

Extra practice room now includes 64kbps #117

Closed Ariana1729 closed 4 years ago

Ariana1729 commented 4 years ago

hopefully, sometimes the 2 rooms does fill up

Ariana1729 commented 4 years ago

I think it shouldn't be too hard to add a command to change bitrates instead, and possibly append like (##kbps)

Ariana1729 commented 4 years ago
  async bitrate (message) {
    let args = message.split(' ').splice(1).filter(str => str!=="")
    let mem = message.member
    let channel = message.member.voiceChannel
    if (channel == null) {
      throw new Error(`<@${message.author.id}>! You aren't in a voice channel`)
    }
    if (args.length == 0) {
      selfDestructMessage(() => message.reply(`<#${channel.id}> bitrate: ` + channel.bitrate))
    } else {
      if (isNanN(args[0])) {
        throw new Error(`<@${message.author.id}>! Input is not a valid bitrate(i.e. 64000)`)
      }
        let guildInfo = await this.client.guildRepository.load(message.guild.id)
      if (!guildInfo.permitted_channels.includes(channel.id)) {
        throw new Error(`<@${message.author.id}>! Not a valid voice channel`)
      }
      let newrate = parseInt(args[0])
      channel.bitrate = newrate
      channel.name += channel.name.replace(/\([0-9]+kbps\)$/,'('+newrate/1000+'kbps)')
    }
  }

i suppose for a bitrate command something like this should suffice? also removes the need for extra the 64kbps rooms

pianiststickman commented 4 years ago

We'd probably want to make sure that the calling user actually had the room locked, but something like that, yes. (It would also save us needing to check if the channel was on the permitted channels list, because only permitted channels can be locked.)

Ariana1729 commented 4 years ago

i guess could also remove the initial commit?

Ariana1729 commented 4 years ago

(need to rework the autovc creation also)