Created
February 15, 2022 07:41
-
-
Save KishoreKaushal/1e4faace984892be756c488d1929777a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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