up db test

This commit is contained in:
2022-06-27 21:50:26 +03:00
parent 611b722f9a
commit 30e9f0e10e
4 changed files with 268 additions and 181 deletions

17
main.py
View File

@@ -15,10 +15,8 @@ logging.basicConfig(stream=sys.stdout, filemode='w', level='INFO',
format='%(asctime)s - %(levelname)s - %(threadName)s - %(message)s')
intents = discord.Intents.all()
intents.typing = True
intents.presences = True
intents = discord.Intents.default()
intents.members = True
bot = commands.Bot(command_prefix='$', guild_subscriptions=True, intents=intents)
f = []
for filenames in walk('audio'):
@@ -29,7 +27,7 @@ f = f[2]
@bot.event
async def on_voice_state_update(member, before, after):
channel = bot.get_channel(783729824896122930)
# channel = bot.get_channel(783729824896122930)
_role = 929729495370461205
_memb = 375664768087752714
_bot_id = 946819004314570852
@@ -37,7 +35,7 @@ async def on_voice_state_update(member, before, after):
if before.channel is None and role in member.roles:
track = random.randint(0, len(f) - 1)
audio_source = FFmpegPCMAudio(f'audio/{f[track]}')
logging.error(f'{track}\t\t\t{f[track]}')
logging.error(f'{track}\t\t{f[track]}')
if not bot.voice_clients:
await sleep(1)
_channel = after.channel
@@ -66,8 +64,11 @@ async def on_voice_state_update(member, before, after):
@bot.event
async def on_member_join(member):
role = discord.utils.get(member.guild.roles, id=734358428939452486)
print(role)
if member.bot == 0:
role = discord.utils.get(member.guild.roles, id=734358428939452486)
else:
role = discord.utils.get(member.guild.roles, id=734358434945826858)
logging.info(f"Adding to {member} role {role}")
await member.add_roles(role)