Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import discord
- import asyncio
- import random
- import youtube_dl
- import secreto
- import time
- import datetime
- from discord import opus
- OPUS_LIBS = ['libopus-0.x86.dll', 'libopus-0.x64.dll',
- 'libopus-0.dll', 'libopus.so.0', 'libopus.0.dylib']
- opts = {
- 'default_search': 'auto',
- 'quiet': True,
- }
- def load_opus_lib(opus_libs=OPUS_LIBS):
- if opus.is_loaded():
- return True
- for opus_lib in opus_libs:
- try:
- opus.load_opus(opus_lib)
- return
- except OSError:
- pass
- raise RuntimeError('Could not load an opus lib. Tried %s' %
- (', '.join(opus_libs)))
- load_opus_lib()
- client = discord.Client()
- TOKEN = secreto.seu_token()
- players = {}
- msg_id = None
- msg_user = None
- COR = 0x690FC3
- @client.event
- async def on_ready():
- print('BOT ONLINE - OLÁ MUNDO')
- print(client.user.name)
- print(client.user.id)
- print('-----RM------')
- @client.event
- async def on_message(message):
- if message.content.lower().startswith('rm!test'):
- await client.send_message(message.channel, "Olá Mundo, estou vivo!")
- if message.content.lower().startswith('rm!moeda'):
- if message.author.id == "408785715481018368": # adicione o seu ID!
- escolha = random.randint(1, 2)
- if escolha == 1:
- await client.add_reaction(message, '😀')
- if escolha == 2:
- await client.add_reaction(message, '👑')
- else:
- await client.send_message(message.channel, " Você não tem permissão para usar esse comando")
- if message.content.lower().startswith('rm!anuncio'):
- msg = message.content[9:]
- channel = client.get_channel("459893978662305793")
- embed = discord.Embed(color=0x65ff00, title="<a:escrevendo:488756791124033537> CHANGELOG STAFF ! ", description="{}".format(msg),
- timestamp=datetime.datetime.utcnow())
- embed.set_footer(text="Anúncio enviado por {}".format(message.author.name), icon_url=message.author.avatar_url)
- await client.send_message(channel, embed=embed)
- if message.content.startswith('rm!entrar'):
- try:
- channel = message.author.voice.voice_channel
- await client.join_voice_channel(channel)
- except discord.errors.InvalidArgument:
- await client.send_message(message.channel, "O bot ja esta em um canal de voz")
- except Exception as error:
- await client.send_message(message.channel, "Ein Error: ```{error}```".format(error=error))
- if message.content.startswith('rm!sair'):
- try:
- mscleave = discord.Embed(
- title="\n",
- color=COR,
- description="Sai do canal de voz e a musica parou!"
- )
- voice_client = client.voice_client_in(message.server)
- await client.send_message(message.channel, embed=mscleave)
- await voice_client.disconnect()
- except AttributeError:
- await client.send_message(message.channel, "O bot não esta em nenhum canal de voz.")
- except Exception as Hugo:
- await client.send_message(message.channel, "Ein Error: ```{haus}```".format(haus=Hugo))
- if message.content.startswith('rm!play'):
- try:
- yt_url = message.content[6:]
- if client.is_voice_connected(message.server):
- try:
- voice = client.voice_client_in(message.server)
- players[message.server.id].stop()
- player = await voice.create_ytdl_player('ytsearch: {}'.format(yt_url))
- players[message.server.id] = player
- player.start()
- mscemb = discord.Embed(
- title="Música para tocar:",
- color=COR
- )
- mscemb.add_field(name="Nome:", value="`{}`".format(player.title))
- mscemb.add_field(name="Visualizações:", value="`{}`".format(player.views))
- mscemb.add_field(name="Enviado em:", value="`{}`".format(player.uploaded_date))
- mscemb.add_field(name="Enviado por:", value="`{}`".format(player.uploadeder))
- mscemb.add_field(name="Duraçao:", value="`{}`".format(player.uploadeder))
- mscemb.add_field(name="Likes:", value="`{}`".format(player.likes))
- mscemb.add_field(name="Deslikes:", value="`{}`".format(player.dislikes))
- await client.send_message(message.channel, embed=mscemb)
- except Exception as e:
- await client.send_message(message.server, "Error: [{error}]".format(error=e))
- if not client.is_voice_connected(message.server):
- try:
- channel = message.author.voice.voice_channel
- voice = await client.join_voice_channel(channel)
- player = await voice.create_ytdl_player('ytsearch: {}'.format(yt_url))
- players[message.server.id] = player
- player.start()
- mscemb2 = discord.Embed(
- title="Música para tocar:",
- color=COR
- )
- mscemb2.add_field(name="Nome:", value="`{}`".format(player.title))
- mscemb2.add_field(name="Visualizações:", value="`{}`".format(player.views))
- mscemb2.add_field(name="Enviado em:", value="`{}`".format(player.upload_date))
- mscemb2.add_field(name="Enviado por:", value="`{}`".format(player.uploader))
- mscemb2.add_field(name="Duraçao:", value="`{}`".format(player.duration))
- mscemb2.add_field(name="Likes:", value="`{}`".format(player.likes))
- mscemb2.add_field(name="Deslikes:", value="`{}`".format(player.dislikes))
- await client.send_message(message.channel, embed=mscemb2)
- except Exception as error:
- await client.send_message(message.channel, "Error: [{error}]".format(error=error))
- except Exception as e:
- await client.send_message(message.channel, "Error: [{error}]".format(error=e))
- if message.content.startswith('rm!parar'):
- try:
- mscpause = discord.Embed(
- title="\n",
- color=COR,
- description="Musica pausada com sucesso!"
- )
- await client.send_message(message.channel, embed=mscpause)
- players[message.server.id].pause()
- except Exception as error:
- await client.send_message(message.channel, "Error: [{error}]".format(error=error))
- if message.content.startswith('rm!pausar'):
- try:
- mscresume = discord.Embed(
- title="\n",
- color=COR,
- description="Musica pausada com sucesso!"
- )
- await client.send_message(message.channel, embed=mscresume)
- players[message.server.id].resume()
- except Exception as error:
- await client.send_message(message.channel, "Error: [{error}]".format(error=error))
- @client.event
- async def on_message(message):
- if message.content.lower().startswith("rm!welcome"):
- embed = discord.Embed(
- title=f"**{message.author.name}**",
- color=0x008000,
- description=f"Olá {message.author.name}, Muito Bem-Vindo a configurações do MercuryBOT!\n\n"
- "**Welcome | Canal de Boas-Vindas do servidor**\n"
- " ❎ | Desativado | Exemplo :\n"
- "```rm!welcome canal welcome #bem-vindos\n```"
- " ✅ | Ativo | rm!welcome bem-vindo <texto>\n"
- "```Mensagem: ${USER} Bem vindo ao servidor ${SERVER}```\n"
- "**Saída | Canal de despedida do servidor**\n"
- " ❎ | Desativado | Exemplo :\n"
- "```rm!welcome canal saida #despedidas\n```"
- " ✅ | Ativo | rm!welcome saida <texto>\n"
- "```Mensagem: ${USER} saiu do servidor```\n"
- "**Privado | Mensagem de boas-vindas no Privado:**\n\n"
- " ❎ | Desativado | Exemplo :\n"
- "```rm!welcome canal saida #despedidas```\n"
- )
- await client.send_message(message.channel, embed=embed)
- @client.event
- async def on_member_join(member):
- canal = client.get_channel("537819894948036626")
- regras = client.get_channel("537824057719128064")
- msg = "Muito Bem-Vindo ao **RedeMercury** {}\n Para saber mais vá em {}\n IP : Está chegando BREVE!".format(
- member.mention, regras.mention)
- await client.send_message(canal, msg) # substitua canal por member para enviar a msg no DM do membro
- @client.event
- async def on_member_remove(member):
- canal = client.get_channel("537820000421937152")
- msg = "**Amigo guerreiro !** {}\n Não esqueça de jogar em nossa REDE! \n **Obrigado , por jogar em nosso servidor!**".format(
- member.mention)
- await client.send_message(canal, msg) # substitua canal por member para enviar a msg no DM do membro
- client.run(TOKEN)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement