Skip to content

Instantly share code, notes, and snippets.

@KishoreKaushal
Created February 15, 2022 07:41
Show Gist options
  • Save KishoreKaushal/1e4faace984892be756c488d1929777a to your computer and use it in GitHub Desktop.
Save KishoreKaushal/1e4faace984892be756c488d1929777a to your computer and use it in GitHub Desktop.
import os
import discord
TOKEN = os.environ['TOKEN']
client = discord.Client()
bot_channel = None
@client.event
async def on_ready():
global bot_channel
print(f"guild-logs-bot logged in as {client.user}")
bot_channel = [x for x in client.get_all_channels() if str(x)=="guild-logs"][0]
print(bot_channel.id)
@client.event
async def on_message(message):
if message.author == client.user or message.channel.id != bot_channel.id:
return
if message.content.startswith('!gl'):
await message.channel.send('Hello')
client.run(TOKEN)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment