Advertisement
Anonimus2009

Bot discord

May 26th, 2021
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. Здраствуйте! Сегодня я покажу код для написания бота discorda.Но для начала используйте библиотеку пайтона pip install discord.py :)
  2. import discord
  3. from discord.ext import commands
  4.  
  5. client = commands.Bot( command_prefix = '.')
  6. # .hello
  7.  
  8. @client.event
  9.  
  10. async def on_ready():
  11. print( 'BOT connected' )
  12.  
  13. @client.command( pass_context = True)
  14.  
  15. async def hello( ctx ):
  16. author = ctx.message.author
  17.  
  18. await ctx.send( f' { author.mention } Hello. I am are BOT for discord' )
  19.  
  20. # Connect
  21.  
  22. token = open( 'token.txt', 'r' ).readline()
  23.  
  24. client.run( token )
  25. токен вписываете в отдельный txt документ!
  26. И также создаете файл server.bat и пишите там это:
  27. @echo off
  28.  
  29. python названия бота .py
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement