up db test
This commit is contained in:
33
test2.py
Normal file
33
test2.py
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import discord
|
||||||
|
import dislash
|
||||||
|
from discord.ext import commands
|
||||||
|
from dislash.slash_commands import check
|
||||||
|
|
||||||
|
bot = commands.Bot(command_prefix="!")
|
||||||
|
inter_client = dislash.InteractionClient(bot)
|
||||||
|
|
||||||
|
|
||||||
|
class Greetings(commands.Cog):
|
||||||
|
def __init__(self, bot):
|
||||||
|
self.bot = bot
|
||||||
|
self._last_member = None
|
||||||
|
|
||||||
|
@commands.Cog.listener()
|
||||||
|
async def on_member_join(self, member):
|
||||||
|
channel = member.guild.system_channel
|
||||||
|
if channel is not None:
|
||||||
|
await channel.send('Welcome {0.mention}.'.format(member))
|
||||||
|
|
||||||
|
@commands.command()
|
||||||
|
async def hello(self, ctx, *, member: discord.Member = None):
|
||||||
|
"""Says hello"""
|
||||||
|
member = member or ctx.author
|
||||||
|
if self._last_member is None or self._last_member.id != member.id:
|
||||||
|
await ctx.send('Hello {0.name}~'.format(member))
|
||||||
|
else:
|
||||||
|
await ctx.send('Hello {0.name}... This feels familiar.'.format(member))
|
||||||
|
self._last_member = member
|
||||||
|
|
||||||
|
|
||||||
|
bot.add_cog(Greetings(bot))
|
||||||
|
bot.run("OTQ3OTUzOTAxNzgzNjIxNjYy.GTXbMv.KrztaTO7-ivsPEAVjsyikSQ-GP-ANwULmDraig")
|
||||||
Reference in New Issue
Block a user