Ok so I’m trying to make a bot for a Dayz(PS4) discord server I’m really struggling on how I can make a shop/economy/casino/killfeed/bountyhunting/squads(factions) I dont even know where to start I’m able to get my bot to join server and do simple commands such as $hello but thats about it im just stuck and need some guidance into the right direction! If you can help that would be awesome!!!
What language and framework are you using?
using Python what do you mean by framework?
You are most likely using discord.py. Can you share a link to your repl?
First anybody can see your bot token. Please use secrets to store it because anybody can spam stuff on your bot right now. https://docs.replit.com/programming-ide/workspace-features/secrets
Ok I think I got it fixed now
import discord
import os
import dotenv
from dotenv import load_dotenv
load_dotenv()
token = os.getenv('DISCORD_TOKEN')
from discord.ext import commands
class MyClient(discord.Client):
async def on_ready(self):
print('Logged on as', self.user)
async def on_message(self, message):
# don't respond to ourselves
if message.author == self.user:
return
if message.content == 'ping':
await message.channel.send('pong')
intents = discord.Intents.default()
intents.message_content = True
client = MyClient(intents=intents)
print(os.getenv("MY_SECRET"))
Which key is your secret?
Hello @legionbots54. I have a working discord bot that has successfully worked for a while now. So I think the issue is that your bot is not running. I do not know why you are printing the secret at the end, but with the code you said was fixed, you aren’t running the bot. I hope you have done all the setup for the bot because otherwise this won’t work:
At the very very end of your program you need this line
client.run(token)
Now one thing that could be a a common error for your bot is if you did not turn on the “send messages” permission in the Discord Developer Portal.
Hope this helps you!
-MilesWK