logo
down
shadow

Discord.js How to send only image/photo url in chat


Discord.js How to send only image/photo url in chat

Content Index :

Discord.js How to send only image/photo url in chat
Tag : javascript , By : WuJanJai
Date : November 28 2020, 12:01 PM

To fix this issue I made code that let bot delete message are not url image not file, and i don't know how it works and this is what i tried but doesn't work. , This is working with urls.
if(!myMessage.startsWith('https://')){
    message.channel.send(`This is not a picture (**${myMessage}**)`)
    return;
}else if(!myMessage.endsWith('png' && 'jpg')){
    message.channel.send(`This is not a picture (**${myMessage}**)`)
    return;
}else{
    bot.user.setAvatar(`${myMessage}`);
    message.channel.send(`Avatar Changed!! **${message.author.username}**`)
}

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

How to send composing / is typing (Chat states) event in Multiuser chat / Group chat & One to One chat in xmpp andro


Tag : android , By : marocchino
Date : March 29 2020, 07:55 AM
I wish this help you Yes, I have idea about it and I have done just before 1 week.
private MessageEventManager mMessageEventManager;
private void chatStateRecognizer(){

        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                mMessageEventManager = new MessageEventManager(mXmppConnection);

                mMessageEventManager.addMessageEventNotificationListener(new MessageEventNotificationListener() {

                    @Override
                    public void offlineNotification(String arg0, String arg1) {

                    }

                    @Override
                    public void displayedNotification(String arg0, String arg1) {

                    }

                    @Override
                    public void deliveredNotification(String from, String arg1) {
                    }

                    @Override
                    public void composingNotification(String from, String to) {
                      Log.i("Receiver:Compose state",from + " is started typing......"+to);
                    }

                    @Override
                    public void cancelledNotification(String from, String to) {
                      Log.i("Receiver:Stop state",from + " is stopped typing......"+to);

                    }
                });
            }
        });

        thread.start();
    }
public class GroupInfoModel implements Comparable<GroupInfoModel>, Serializable{

    private static final long serialVersionUID = 1L;
    private String memberId = "", memberName = "";
    private boolean isAdmin;
    public String getMemberId() {
        return memberId;
    }
    public void setMemberId(String memberId) {
        this.memberId = memberId;
    }
    public String getMemberName() {
        return memberName;
    }
    public void setMemberName(String memberName) {
        this.memberName = memberName;
    }
    public boolean isAdmin() {
        return isAdmin;
    }
    public void setAdmin(boolean isAdmin) {
        this.isAdmin = isAdmin;
    }
    @Override
    public int compareTo(GroupInfoModel another) {
        return getMemberName().compareTo(another.getMemberName());
    }
}
private ArrayList<GroupInfoModel> groupDetailsList = new ArrayList<GroupInfoModel>();

private boolean isComposingStarted;
groupDetailsList.clear();
ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(mXmppConnection);
DiscoverItems items = discoManager.discoverItems(mRoomId);
    for (Iterator<Item> it = items.getItems(); it.hasNext();) {
        DiscoverItems.Item item = (DiscoverItems.Item) it.next();
        String occupant = item.getEntityID();
        occupant = occupant.split("/")[1];
        GroupInfoModel groupInfoModel = new GroupInfoModel();
        groupInfoModel.setAdmin(false);
        groupInfoModel.setMemberId(occupant+"@"+mServiceNameHere);
        groupInfoModel.setMemberName(occupant);
        groupDetailsList.add(groupInfoModel);
    }
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
    if(s.toString().length()==1&&!isComposingStarted){
        isComposingStarted = true;
        if(chatType.equals("OneToOneChat")){
           mMessageEventManager.sendComposingNotification(myJabberId, friendJabberId);
        }else if(chatType.equals("GroupChat")){
           for (int i = 0; i < groupDetailsList.size(); i++) {
            if(!groupDetailsList.get(i).getMemberId().contains(myJabberId)){
              mMessageEventManager.sendComposingNotification(groupDetailsList.get(i).getMemberId(), roomId);    
            }
           }
        }
    }else if(s.toString().length()==0){
        isComposingStarted = false;
        if(chatType.equals("OneToOneChat")){
            mMessageEventManager.sendCancelledNotification(myJabberId, friendJabberId);
        }else if(chatType.equals("GroupChat")){
            for (int i = 0; i < groupDetailsList.size(); i++) {
               if(!groupDetailsList.get(i).getMemberId().contains(myJabberId)){
                 mMessageEventManager.sendCancelledNotification(groupDetailsList.get(i).getMemberId(), roomId); 
               }
            }
        }
    }
}

Laravel Chat Message. Saving Image send in chat?


Tag : php , By : TheDave1022
Date : March 29 2020, 07:55 AM
Any of those help You have to store image in some folger eg. public_path("uploads/") in laravel
create new image_path field in your existing table and store the image name in that field, name the image like this timestamp + random

I'm trying to send data from a cell range to a discord chat channel


Tag : javascript , By : Tony Siu
Date : March 29 2020, 07:55 AM
Hope this helps getRange returns a Range object.
From the docs we can see there's a getValues() method which returns a two dimensional array containing the data in each cell.
var data = range.getValues();
var result = '';

for (var i = 0; i < data.length; i++) {
   var d = data[i];
   for (var j = 0; j < d.length; j++) {
       result = result.concat(d[j]);
   }
}

How to make a Discord.js bot read and use image urls which have been sent in chat


Tag : javascript , By : Ashaea
Date : March 29 2020, 07:55 AM
this one helps. I am making a bot which will check if a message contains an image link matches a preset image list, and so it responds accordingly! , Its EZ
message.channel.send(message.attachments.first().url)

How to make my Discord bot send a message to the chat


Tag : python , By : Vorinowsky
Date : March 29 2020, 07:55 AM
like below fixes the issue Instead of using send_message, try message.channel.send.
for example:
await message.channel.send("Hey.")
Related Posts Related QUESTIONS :
  • Instantiate subclass without constructing
  • Outputing a created object in javascript to a server side JSON file
  • Transition the numeric labels in a bar chart
  • createBottomTabNavigator: hide just one tab from the tabBar
  • iife vs simple statement behavior with document.title
  • showDialogPopup Refresh Page after Click
  • Child component does not set the initial value passed from the parent: ReactJS
  • Nodejs javascript added to button not responding
  • Trying to define a promise.all
  • Python GEE to extract featurecollection timeseries from Landsat imageries
  • How to write negative binary number?
  • Unable to set property of individual object
  • Why Named Function Expression itself cannot assign Name to another Value?
  • How to reset scroll position on single page pagination
  • How to scroll to bottom of page, when a new message is sent - Socket.io
  • How to reconstruct audio blob from a base64 encoded String?
  • How to calculate numbers within an array of objects
  • Using JavaScript to change CSS properties of SVG circles for all circles that was not clicked
  • Is there value in propTypeing repeat required properties at every level of nested components?
  • Call function if variable does not exist in a filter
  • localStorage value doesn't get updated automatically
  • React not updating state with setState correctly inside promises
  • Direct native JavaScript or jQuery method to get containing block of an element
  • Dynamic JSON object to Html Table
  • How to send Id and file to same controller?
  • How to Make a jQuery Table Cell(td) clickable to Run a Function?
  • Prevent the duplicate function onchange event jQuery
  • Reactjs Input Upload doesn't return local URL
  • An unexpected 'StartObject' node was found when reading from the JSON reader. A 'PrimitiveValue' node was expected
  • How to filter a JSON Array, with an eventListener input value at keyup
  • How to separate the different properties of filter in css?
  • Why dont work change event of bootstrap input spinner?
  • How to hide overflow text content in react
  • Is there another way to write line 6
  • Cypress - how to find by text content?
  • How to setstate for the dynamic checkboxes in a loop in react?
  • Is display:none safe?
  • How to create a form to change part of a href url of a button?
  • Put many function inside function in Javascript
  • how to exit from loop after a ajax call
  • Do Angular Reactive Form Validator.min/max check Perform Type Conversions before checking the value?
  • How to Replace Text Within Script Tags Using JQuery
  • add variable to object if not undefined using short-hand
  • How can I effectively curve my items inside a list?
  • Add new record Keyboard Shortcut on Kendo Grid Mvc
  • Time and Date running on page
  • Looping through page links puppeteer doesn't return values from the newly loaded page
  • Problem with Navigator.geoLocation.getCurrentPosition not working
  • Trying to change the id of an element with Javascript
  • Embedded Schema Inserting Blank in Meteor using Collection2
  • avoid useEffect to render at first load?
  • Why is this CSS transition only working correctly on the some clicks? How to solve it?
  • Interpolated values does not reflect the latest values in an Angular app
  • Javascript classes define attribute in constructor or outside the class
  • How to block scroll event passing through to iframe until iframe is active?
  • What is the purpose of "constructor" method in javascript?
  • Stencil JS not working with non-default imports
  • Are frameworks misleadingly named for marketing purposes?
  • React <Redirect> after transition not working
  • How to send multiple parameters in a function using EJS
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com