Top.Mail.Ru
Ответы

Дискорд бот заходил к другому профилю через токен

Как сделать чтобы дискорд бот заходил к другому профилю через токен и когда ему звонили то он бы отвечал и включал музыки например

По дате
По рейтингу
Аватар пользователя
12345678910111213141516171819202122232425262728293031323334353637383940414243
 import discord 
from discord.ext import commands 
 
TOKEN = 'YOUR_BOT_TOKEN_HERE' 
NEW_PROFILE_TOKEN = 'NEW_PROFILE_TOKEN_HERE' 
 
intents = discord.Intents.default() 
intents.voice_states = True 
 
bot = commands.Bot(command_prefix='!', intents=intents) 
 
@bot.event 
async def on_ready(): 
    print(f'Logged in as {bot.user}') 
 
@bot.command() 
async def join(ctx): 
    channel = ctx.author.voice.channel 
    await channel.connect() 
 
@bot.command() 
async def leave(ctx): 
    await ctx.voice_client.disconnect() 
 
@bot.event 
async def on_message(message): 
    if message.author == bot.user: 
        return 
 
    if message.content == 'ping': 
        await message.channel.send('pong') 
 
@bot.event 
async def on_voice_state_update(member, before, after): 
    if member == bot.user: 
        return 
 
    if before.channel is None and after.channel is not None: 
        voice_client = await after.channel.connect() 
        source = discord.FFmpegPCMAudio('music.mp3') 
        voice_client.play(source) 
 
bot.run(NEW_PROFILE_TOKEN) 
Аватар пользователя
Ученик

а можешь дать свой тг? есть пару вопросов

Аватар пользователя
Ученик

а можешь дать свой тг? есть пару вопросов

Аватар пользователя
Ученик

Зачем?



Видео по теме