Discord making bot code example
Example 1: how to make a discord bot python
import discord
class MyClient(discord.Client):
async def on_connect(self):
print('[LOGS] Connecting to discord!')
async def on_ready(self):
print('[LOGS] Bot is ready!')
print("""[LOGS] Logged in: {}\n[LOGS] ID: {}\n[LOGS] Number of users: {}""".format(self.bot.user.name, self.bot.user.id, len(set(self.bot.get_all_members()))))
await self.bot.change_presence(activity=discord.Game(name="Weeke is a god!"))
async def on_resumed(self):
print("\n[LOGS] Bot has resumed session!")
async def on_message(self, message):
if message.author == self.user:
return
if message.content == 'ping':
await ctx.send(f'Client Latency: {round(self.bot.latency * 1000)}')
client = MyClient()
client.run('token')
Example 2: how to make a discord bot
//discord.js is probably the easiest to learn. To install do this
//in command prompt (Windows, Linux) or terminal (Mac)
npm init
//and then
npm i discord.js
//after that just read the discord.js.org documentation
//and follow a couple yt guides, maybe join some servers.
Example 3: how to make disord bot
follow this https://discordpy.readthedocs.io/en/latest/discord.html to make bot account
use discord api of your laugaungue of choice
discord.py https://discordpy.readthedocs.io/en/latest/index.html
discord.js https://discord.js.org/
Example 4: how to get a bot online on discord
const Discord = require('discord.js');
const bot = new Discord.Client();
const TOKEN = "put ur token";
bot.login(TOKEN);