Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.56 KB | None | 0 0
  1. import discord
  2.  
  3. from discord.ext import commands
  4. from datetime import datetime
  5.  
  6. from config import settings
  7.  
  8. #Details of the BOT
  9. _name_ = 'HaTe BOT'
  10. _version_ = 0.85
  11. _author_ = 'slative.py'
  12.  
  13. #Defines of the client (BOT)
  14. client = discord.Client()
  15. bot = commands.Bot(command_prefix=settings.__prefix__)
  16.  
  17. '''
  18. TODO LIST:
  19.  
  20. + verify command / DOING
  21. + sending the rules to dm if a player joins
  22. '''
  23.  
  24.  
  25.  
  26. @bot.command()
  27. async def verify(ctx):
  28. channel = discord.utils.get(ctx.message.guild.channels, name='verify')
  29. role = discord.utils.get(ctx.message.guild.roles, name='VERIFIED')
  30. member = ctx.message.author
  31.  
  32. if channel is not None:
  33. if ctx.message.channel == channel:
  34. await member.add_roles(role)
  35.  
  36.  
  37.  
  38. @bot.command()
  39. async def test(ctx):
  40. await ctx.send('test')
  41.  
  42.  
  43.  
  44. @client.event
  45. async def on_raw_reaction_add(payload):
  46. guild = discord.utils.find(lambda g : g.id == payload.guild_id, client.guilds)
  47. channel = discord.utils.get(client.get_guild(payload.guild_id).channels, name="rules")
  48.  
  49. if channel is not None:
  50. if payload.emoji.name == '\U00002705':
  51. role = discord.utils.get(guild.roles, name='AGREED')
  52.  
  53. if role is not None:
  54. member = discord.utils.find(lambda m : m.id == payload.user_id, guild.members)
  55.  
  56. if member is not None:
  57. await member.add_roles(role)
  58.  
  59.  
  60.  
  61. #When a member joins on the server
  62. @client.event
  63. async def on_member_join(member):
  64. channel = discord.utils.get(member.guild.channels, name='welcome')
  65. rulesChannel = discord.utils.get(member.guild.channels, name='rules')
  66. verifyChannel = discord.utils.get(member.guild.channels, name='verify')
  67.  
  68. if channel is not None:
  69. embed=discord.Embed(title=f"Welcome to {member.guild}!", description="Thank you for choosing to join the server!", color=0x41ba5d)
  70.  
  71. embed.set_thumbnail(url=member.avatar_url)
  72. embed.add_field(name='Name: ', value=member.mention, inline=True)
  73. embed.add_field(name='Members: ', value=member.guild.member_count, inline=True)
  74. embed.add_field(name='Please read this to continue: ', value=f'Be smart and go to {rulesChannel.mention} and verify yourself in {verifyChannel.mention}!')
  75. embed.set_footer(text=f'joined at {datetime.now()}.')
  76.  
  77. await channel.send(embed=embed)
  78.  
  79. if verifyChannel is not None:
  80. embed=discord.Embed(title=f"Verify yourself!", description=f"{member.mention} use 8$verify", color=0x41ba5d)
  81.  
  82. await verifyChannel.send(embed=embed)
  83.  
  84.  
  85.  
  86. #When a member leaves on the server
  87. @client.event
  88. async def on_member_remove(member):
  89. channel = discord.utils.get(member.guild.channels, name='welcome')
  90.  
  91. if channel is not None:
  92. embed=discord.Embed(title=f"Experiences on {member.guild}!", description="Thank you for being there, goodbye!", color=0xba4341)
  93.  
  94. embed.set_thumbnail(url=member.avatar_url)
  95. embed.add_field(name='Name: ', value=member.mention, inline=True)
  96. embed.add_field(name='Members: ', value=member.guild.member_count, inline=True)
  97. embed.set_footer(text=f'leaved at {datetime.now()}.')
  98.  
  99. await channel.send(embed=embed)
  100.  
  101.  
  102.  
  103. #When the bot joins on the server
  104. @client.event
  105. async def on_guild_join(guild):
  106. embed = discord.Embed(title=':white_check_mark: Server added!', description='Thank you for adding me on your server!', type='rich', color=0x419eba)
  107.  
  108. embed.set_thumbnail(url=guild.icon_url)
  109. embed.add_field(name='Name: ', value=guild.name, inline=True)
  110. embed.add_field(name='ID: ', value=guild.id, inline=True)
  111. embed.add_field(name='Region: ', value=guild.region, inline=True)
  112. embed.add_field(name='Members: ', value=guild.member_count, inline=True)
  113. embed.add_field(name='Roles: ', value=str(len(guild.roles)), inline=True)
  114. embed.add_field(name='Created at: ', value=guild.created_at, inline=True)
  115. embed.set_footer(text=f'joined at {datetime.now()}.')
  116.  
  117. await guild.owner.send(embed=embed)
  118.  
  119.  
  120.  
  121. #Informations on the start, if the bot is ready
  122. @client.event
  123. async def on_ready():
  124. print('}~~~~~~~~~~~~~~~~~~~~~~~~~~~{')
  125. print(f' - Name: {_name_.upper()}')
  126. print(f' - Version: {_version_}')
  127. print(f' - Author: {_author_}')
  128. print('')
  129. print(f' - Currently on {str(len(client.guilds))} servers!')
  130. print('}~~~~~~~~~~~~~~~~~~~~~~~~~~~{')
  131.  
  132. await client.change_presence(status=discord.Status.online, activity=discord.Game(name='use 8$ as prefix!'))
  133.  
  134.  
  135.  
  136. #Starts the client (BOT)
  137. client.run(settings.__token__)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement