showing results for - "beginning node js"
Edoardo
28 May 2016
1# Discord.py is a API wrapper for python. 
2Docs = "https://discordpy.readthedocs.io/en/latest/"
3PyPI = "pip install -U discord.py"
4
5# --- A simple bot ---
6
7import discord
8from discord.ext import commands 
9
10client = commands.Bot(comand_prefix='bot prefix here') # You can choose your own prefix here
11
12@client.event()
13async def on_ready(): # When the bot starts
14    print(f"Bot online and logged in as {client.user}")
15
16# A simple command
17@client.command(aliases=["ms", "aliases!"]) # You make make the command respond to other commands too
18async def ping(ctx, a_variable): # a_variable is a parameter you use in the command
19    await ctx.send(f"Pong! {round(client.latency * 1000)}ms. Your input was {a_variable}")
20
21client.run('your token here') # Running the bot
Christian
02 Jan 2017
1node
2>"write code"
3"write code"
similar questions
queries leading to this page
beginning node js