Merge branch 'rewrite' of https://github.com/Phxntxm/Bonfire into rewrite
This commit is contained in:
commit
92514b6987
|
@ -83,7 +83,6 @@ class Interaction:
|
|||
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
# Format for battles: {'serverid': {'player1': 'player2', 'player1': 'player2'}}
|
||||
self.battles = {}
|
||||
|
||||
def get_battle(self, player):
|
||||
|
|
45
cogs/misc.py
45
cogs/misc.py
|
@ -182,26 +182,35 @@ class Miscallaneous:
|
|||
# Add the normal values
|
||||
embed.add_field(name='Total Servers', value=len(self.bot.guilds))
|
||||
embed.add_field(name='Total Members', value=len(self.bot.users))
|
||||
hm = self.bot.get_cog('Hangman')
|
||||
ttt = self.bot.get_cog('TicTacToe')
|
||||
bj = self.bot.get_cog('Blackjack')
|
||||
interaction = self.bot.get_cog('Blackjack')
|
||||
music = self.bot.get_cog('Music')
|
||||
|
||||
# Count the variable values; hangman, tictactoe, etc.
|
||||
hm_games = len(self.bot.get_cog('Hangman').games)
|
||||
|
||||
ttt_games = len(self.bot.get_cog('TicTacToe').boards)
|
||||
|
||||
bj_games = len(self.bot.get_cog('Blackjack').games)
|
||||
|
||||
count_battles = 0
|
||||
for battles in self.bot.get_cog('Interaction').battles.values():
|
||||
count_battles += len(battles)
|
||||
|
||||
if hm_games:
|
||||
embed.add_field(name='Total Hangman games running', value=hm_games)
|
||||
if ttt_games:
|
||||
embed.add_field(name='Total TicTacToe games running', value=ttt_games)
|
||||
if count_battles:
|
||||
embed.add_field(name='Total battles games running', value=count_battles)
|
||||
if bj_games:
|
||||
embed.add_field(name='Total blackjack games running', value=bj_games)
|
||||
if hm:
|
||||
hm_games = len(hm.games)
|
||||
if hm_games:
|
||||
embed.add_field(name='Total Hangman games running', value=hm_games)
|
||||
if ttt:
|
||||
ttt_games = len(ttt.boards)
|
||||
if ttt_games:
|
||||
embed.add_field(name='Total TicTacToe games running', value=ttt_games)
|
||||
if bj:
|
||||
bj_games = len(bj.games)
|
||||
if bj_games:
|
||||
embed.add_field(name='Total blackjack games running', value=bj_games)
|
||||
if interaction:
|
||||
count_battles = 0
|
||||
for battles in self.bot.get_cog('Interaction').battles.values():
|
||||
count_battles += len(battles)
|
||||
if count_battles:
|
||||
embed.add_field(name='Total battles games running', value=count_battles)
|
||||
if music:
|
||||
songs = len([x for x in music.voice_states.values() if x.playing])
|
||||
if songs:
|
||||
embed.add_field(name='Total songs playing', value=songs)
|
||||
|
||||
if hasattr(self.bot, 'uptime'):
|
||||
embed.add_field(name='Uptime', value=(pendulum.utcnow() - self.bot.uptime).in_words())
|
||||
|
|
|
@ -24,6 +24,17 @@ class VoiceState:
|
|||
self.required_skips = 0
|
||||
self.skip_votes = set()
|
||||
self.audio_player = bot.loop.create_task(self.audio_player_task())
|
||||
self._volume = 50
|
||||
|
||||
@property
|
||||
def volume(self):
|
||||
return self._volume
|
||||
|
||||
@volume.setter
|
||||
def volume(self, v):
|
||||
self._volume = v
|
||||
if self.voice and self.voice.source:
|
||||
self.voice.source.volume = v
|
||||
|
||||
@property
|
||||
def voice(self):
|
||||
|
@ -57,7 +68,7 @@ class VoiceState:
|
|||
before_options='-nostdin',
|
||||
options='-vn -b:a 128k'
|
||||
)
|
||||
source = PCMVolumeTransformer(source)
|
||||
source = PCMVolumeTransformer(source, volume=self.volume)
|
||||
self.voice.play(source, after=self.after)
|
||||
self.current.start_time = time.time()
|
||||
|
||||
|
@ -351,15 +362,16 @@ class Music:
|
|||
"""Sets the volume of the currently playing song."""
|
||||
|
||||
state = self.voice_states.get(ctx.message.guild.id)
|
||||
if state is None or state.voice is None or state.voice.source is None:
|
||||
await ctx.send("Not playing anything right now, please set volume after playing something")
|
||||
if value:
|
||||
value = value / 100
|
||||
if state is None or state.voice is None:
|
||||
await ctx.send("I need to be in a channel before my volume can be set")
|
||||
elif value is None:
|
||||
volume = state.voice.source.volume
|
||||
await ctx.send("Current volume is {}".format(volume))
|
||||
elif value > 200:
|
||||
await ctx.send("Sorry but the max volume is 200")
|
||||
elif state.playing:
|
||||
state.voice.source.volume = value / 100
|
||||
await ctx.send('Current volume is {:.0%}'.format(state.voice.source.volume))
|
||||
elif value > 1.0:
|
||||
await ctx.send("Sorry but the max volume is 100%")
|
||||
else:
|
||||
state.volume = value
|
||||
await ctx.send('Set the volume to {:.0%}'.format(state.voice.source.volume))
|
||||
|
||||
@commands.command(pass_context=True)
|
||||
|
|
|
@ -140,6 +140,17 @@ class Owner:
|
|||
await utils.update_content('motd', entry, key)
|
||||
await ctx.send("New motd update for {}!".format(date))
|
||||
|
||||
@commands.command()
|
||||
@commands.check(utils.is_owner)
|
||||
async def sendtochannel(self, ctx, cid: int, *, message):
|
||||
"""Sends a message to a provided channel, by ID"""
|
||||
channel = self.bot.get_channel(cid)
|
||||
await channel.send(message)
|
||||
try:
|
||||
await ctx.message.delete()
|
||||
except discord.Forbidden:
|
||||
pass
|
||||
|
||||
@commands.command()
|
||||
@commands.check(utils.is_owner)
|
||||
async def debug(self, ctx, *, code: str):
|
||||
|
|
Loading…
Reference in a new issue