Skip to content

Instantly share code, notes, and snippets.

@Colk-tech
Created February 9, 2021 14:53
Show Gist options
  • Save Colk-tech/b7a492c8816c27b2dce8fa81a59ae10d to your computer and use it in GitHub Desktop.
Save Colk-tech/b7a492c8816c27b2dce8fa81a59ae10d to your computer and use it in GitHub Desktop.
@approver のはらちょBOT様DiscordBOTの雛形です
import os
import discord
class MainClient(discord.Client):
def __init__(self, token: str):
intents = discord.Intents.all()
intents.members = True
super(MainClient, self).__init__(presences=True, guild_subscriptions=True, intents=intents)
self.token = token
def launch(self):
self.run(self.token)
async def on_ready(self):
pass
async def on_message(self, message: discord.Message):
pass
async def on_voice_state_update(self, member, before, after):
pass
async def on_message_edit(self, before, after):
pass
async def on_message_delete(self, message: discord.Message):
pass
async def on_guild_role_create(self, role):
pass
if __name__ == "__main__":
TOKEN = os.environ["TOKEN"]
MAIN = MainClient(TOKEN)
MAIN.launch()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment